LibGfx: Fail PNG decode if output bitmap can't be allocated

Otherwise we'll assert soon afterwards.

Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28838
This commit is contained in:
Andreas Kling 2020-12-20 15:22:41 +01:00
parent 6e0976d858
commit 3e0b913e44
Notes: sideshowbarker 2024-07-19 00:43:47 +09:00

View file

@ -617,6 +617,11 @@ static bool decode_png_bitmap_simple(PNGLoadingContext& context)
context.bitmap = Bitmap::create_purgeable(context.has_alpha() ? BitmapFormat::RGBA32 : BitmapFormat::RGB32, { context.width, context.height });
if (!context.bitmap) {
context.state = PNGLoadingContext::State::Error;
return false;
}
unfilter(context);
return true;