|Summary:||REGRESSION(r198782): SHOULD NEVER BE REACHED failure in ImageSource::setData since r198782|
|Product:||WebKit||Reporter:||Carlos Garcia Campos <cgarcia>|
|Severity:||Normal||CC:||bugs-noreply, sabouhallawa, simon.fraser|
|Version:||WebKit Local Build|
|Bug Depends on:|
Description Carlos Garcia Campos 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.
Comment 2 Simon Fraser (smfr) 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".
Comment 3 Carlos Garcia Campos 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.
Comment 4 Carlos Garcia Campos 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.
Comment 5 Carlos Garcia Campos 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.
Comment 6 Michael Catanzaro 2016-04-19 10:01:03 PDT
Comment on attachment 276704 [details] Updated patch Please wait one day in case Said has comments.