1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:45:07 +00:00

LibGfx: Teach all image decoders to fail on bitmap allocation failure

We don't need to wait for oss-fuzz to find this for us. :^)
This commit is contained in:
Andreas Kling 2020-12-20 16:04:29 +01:00
parent 71d92cef17
commit c7d0c2ee7a
7 changed files with 27 additions and 2 deletions

View file

@ -319,6 +319,10 @@ static bool read_image_data(PPMLoadingContext& context, Streamer& streamer)
return false;
context.bitmap = Bitmap::create_purgeable(BitmapFormat::RGB32, { context.width, context.height });
if (!context.bitmap) {
context.state = PPMLoadingContext::State::Error;
return false;
}
size_t index = 0;
for (int y = 0; y < context.height; ++y) {