CFStrings created via StringImpl::createCFString() might reference freed memory when Objective-C garbage collection is enabled
Created attachment 191035 [details]
Comment on attachment 191035 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=191035&action=review
sorry about that!
> + However, custom allocators aren't supported when Objective-C garbage
> + collection is enabled, so in this case we use the default CF allocator.
> + Since we can't guarantee the lifetime of the StringImpl in this case,
> + we should just fall back to copying the string.
You can add rXXXX stupidly broke this by not checking if StringWrapperCFAllocator::allocator returns something.
> +#if PLATFORM(MAC)
> -#if PLATFORM(MAC)
> // Since garbage collection isn't compatible with custom allocators, don't use this at all when garbage collection is active.
> - if (objc_collectingEnabled())
> + if (garbageCollectionEnabled())
> return 0;
You should get rid of this and just ASSERT(!garbageCollectionEnabled)
// Since garbage collection isn't compatible with custom allocators, don't use this at all when garbage collection is active.
should be put before garbageCollectionEnabled() in StringImpl::createCFString() IMHO
+ remove the static as asked on IRC :)
oh, + "inline" for static bool garbageCollectionEnabled() since the static can go away :)
Committed r144507: <http://trac.webkit.org/changeset/144507>