1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 00:08:11 +00:00

LibGfx: Fail PNG decoding on invalid scanline filter

Only filter types 0 thru 4 are valid.
This commit is contained in:
Andreas Kling 2020-06-11 09:32:17 +02:00
parent d59a308c7e
commit fea77abcf6

View file

@ -600,6 +600,12 @@ static bool decode_png_bitmap(PNGLoadingContext& context)
return false;
}
if (filter > 4) {
dbg() << "Invalid PNG filter: " << filter;
context.state = PNGLoadingContext::State::Error;
return false;
}
context.scanlines.append({ filter });
auto& scanline_buffer = context.scanlines.last().data;
auto row_size = ((context.width * context.channels * context.bit_depth) + 7) / 8;