mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
WebContent: Prevent renderer crash on partially invalid image
If an image had a valid header and valid metadata, but decoding the image frame data failed, the renderer used to crash. The crash only happened in SerenityOS, because there ImageCodecPluginSerenity returned nullptr bitmaps. Instead, return {} like ImageCodecPluginLadybird already does if there's a nullptr frame. Fixes #19141. Loading #19141 in the browser satisfyingly also serves as a manual test for the bug. (No automated test since we don't run layout tests within SerenityOS on the bots.)
This commit is contained in:
parent
5617dd1c83
commit
c9b8af70bf
1 changed files with 2 additions and 0 deletions
|
@ -31,6 +31,8 @@ Optional<Web::Platform::DecodedImage> ImageCodecPluginSerenity::decode_image(Rea
|
|||
decoded_image.is_animated = result.is_animated;
|
||||
decoded_image.loop_count = result.loop_count;
|
||||
for (auto const& frame : result.frames) {
|
||||
if (!frame.bitmap)
|
||||
return {};
|
||||
decoded_image.frames.empend(move(frame.bitmap), frame.duration);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue