WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
164617
REGRESSION(
r207182
): [iOS] Crash because of passing freed CFDictionaryRef to CG when decoding a sub-sampled large image
https://bugs.webkit.org/show_bug.cgi?id=164617
Summary
REGRESSION(r207182): [iOS] Crash because of passing freed CFDictionaryRef to ...
Said Abou-Hallawa
Reported
2016-11-10 14:11:36 PST
On iOS image sub-sampling is enabled by default, WebCore::imageSourceOptions() creates a new dictionary for the image options every time it is called. Because ImageDecoder::createFrameImageAtIndex() takes the raw pointer of the output of imageSourceOptions(), CFRelease() is called for the returned retain pointer. This happens immediately after assigning the raw pointer to the local variable. This causes the CFDictionaryRef to be freed before passing it to CGImageSourceCreateImageAtIndex(). CFDictionaryRef options = imageSourceOptions(subsamplingLevel, decodingMode).get(); RetainPtr<CGImageRef> image = adoptCF(CGImageSourceCreateImageAtIndex(m_nativeDecoder.get(), index, options)); The original code was not getting the raw pointer into a local variable. Instead it was passing it directly to CGImageSourceCreateImageAtIndex(). This prevents calling CFRelease() before CGImageSourceCreateImageAtIndex returns. RetainPtr<CGImageRef> image = adoptCF(CGImageSourceCreateImageAtIndex(m_nativeDecoder.get(), index, imageSourceOptions(subsamplingLevel).get()));
Attachments
Patch
(5.20 KB, patch)
2016-11-10 16:53 PST
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(3.25 KB, patch)
2016-11-10 17:02 PST
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Said Abou-Hallawa
Comment 1
2016-11-10 14:12:43 PST
<
rdar://problem/28907947
>
Said Abou-Hallawa
Comment 2
2016-11-10 16:53:37 PST
Created
attachment 294443
[details]
Patch
Tim Horton
Comment 3
2016-11-10 16:59:16 PST
Comment on
attachment 294443
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=294443&action=review
> Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp:65 > + CFDictionaryAddValue(options.get(), kCGImageSourceShouldCache, kCFBooleanTrue);
Why swap to Add? Set is a tiny bit cheaper (I think?) and we know that each key will only be used once.
Said Abou-Hallawa
Comment 4
2016-11-10 17:02:08 PST
Created
attachment 294444
[details]
Patch
WebKit Commit Bot
Comment 5
2016-11-10 18:23:53 PST
Comment on
attachment 294444
[details]
Patch Clearing flags on attachment: 294444 Committed
r208575
: <
http://trac.webkit.org/changeset/208575
>
WebKit Commit Bot
Comment 6
2016-11-10 18:23:57 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug