1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00

LibGfx/BMPLoader: Make sure height passed to Gfx::Bitmap is positive

BMP files encode the direction of the rows with the sign of the height.
Our BMP decoder already makes all the proper checks, however when
constructing the Gfx::Bitmap, didn't actually make the height positive.

Boog neutralized :^)
This commit is contained in:
circl 2023-10-18 19:56:09 +02:00 committed by Andreas Kling
parent 99217bf6db
commit a9208a18ca
Notes: sideshowbarker 2024-07-17 07:25:39 +09:00

View file

@ -1271,7 +1271,7 @@ static ErrorOr<void> decode_bmp_pixel_data(BMPLoadingContext& context)
}
u32 const width = abs(context.dib.core.width);
u32 const height = !context.is_included_in_ico ? context.dib.core.height : (context.dib.core.height / 2);
u32 const height = !context.is_included_in_ico ? abs(context.dib.core.height) : (abs(context.dib.core.height) / 2);
context.bitmap = TRY(Bitmap::create(format, { static_cast<int>(width), static_cast<int>(height) }));