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

LibGfx: Prevent potential heap-overflow in BMP non-RLE

This commit is contained in:
Ben Wiederhake 2020-12-01 22:22:20 +01:00 committed by Andreas Kling
parent 461bdeda2b
commit 6be9b6349d

View file

@ -1200,7 +1200,7 @@ static bool decode_bmp_pixel_data(BMPLoadingContext& context)
return false;
}
auto buffer = ByteBuffer::wrap(const_cast<u8*>(context.file_bytes + context.data_offset), context.file_size);
auto buffer = ByteBuffer::wrap(const_cast<u8*>(context.file_bytes + context.data_offset), context.file_size - context.data_offset);
if (context.dib.info.compression == Compression::RLE4 || context.dib.info.compression == Compression::RLE8
|| context.dib.info.compression == Compression::RLE24) {