RESOLVED FIXED Bug 156690
REGRESSION(r198782): SHOULD NEVER BE REACHED failure in ImageSource::setData since r198782
https://bugs.webkit.org/show_bug.cgi?id=156690
Summary REGRESSION(r198782): SHOULD NEVER BE REACHED failure in ImageSource::setData ...
Carlos Garcia Campos
Reported 2016-04-18 02:32:20 PDT
The assertion is wrong, because it assumes that ImageDecoder::create() always returns a valid pointer, which is only true for the CG implementation. The non CG implementation can return nullptr if there isn't enough data to figure out the image format or if the image format is not supported. This is causing several crashes in the debug bots.
Attachments
Patch (3.11 KB, patch)
2016-04-18 02:34 PDT, Carlos Garcia Campos
no flags
Updated patch (2.88 KB, patch)
2016-04-19 00:56 PDT, Carlos Garcia Campos
mcatanzaro: review+
Carlos Garcia Campos
Comment 1 2016-04-18 02:34:59 PDT
Simon Fraser (smfr)
Comment 2 2016-04-18 10:28:50 PDT
Comment on attachment 276626 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=276626&action=review > Source/WebCore/platform/graphics/ImageSource.cpp:74 > +bool ImageSource::tryEnsureDecoderIfNeeded(const SharedBuffer& data) "try ensure" is not a good name, and "if needed" is more like "if possible".
Carlos Garcia Campos
Comment 3 2016-04-18 23:36:44 PDT
(In reply to comment #2) > Comment on attachment 276626 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=276626&action=review > > > Source/WebCore/platform/graphics/ImageSource.cpp:74 > > +bool ImageSource::tryEnsureDecoderIfNeeded(const SharedBuffer& data) > > "try ensure" is not a good name, and "if needed" is more like "if possible". My initial idea was to use try create instead, but normally try create methods return the created object or nullptr, but this one ensures it exists. So that's why I kept the ensure part. The "if possible" is already covered by try, if needed is not because ImageDecoder::create can fail, but because there's an early return in case the decoder has already been created. I added the if needed because I initially called it try create, but I agree the ensure also covers if needed. In any case, the ensure method is only called by setData() so I wonder if we really need an ensure method after all.
Carlos Garcia Campos
Comment 4 2016-04-18 23:37:44 PDT
Btw, this is causing a lot of crashes in a our debug bot, so I would like tho fix this soon, to avoid the early exit.
Carlos Garcia Campos
Comment 5 2016-04-19 00:56:00 PDT
Created attachment 276704 [details] Updated patch I think the code is simpler and clearer without the ensure method. In the end we can't ensure the decoder is created.
Michael Catanzaro
Comment 6 2016-04-19 10:01:03 PDT
Comment on attachment 276704 [details] Updated patch Please wait one day in case Said has comments.
Carlos Garcia Campos
Comment 7 2016-04-19 23:02:17 PDT
Note You need to log in before you can comment on or make changes to this bug.