LibGfx/ILBM: Avoid overflow when creating bitplane data buffer

This commit is contained in:
Tim Ledbetter 2023-10-30 18:53:16 +00:00 committed by Andreas Kling
parent 5e1017bcf1
commit b96a5f4265
Notes: sideshowbarker 2024-07-19 01:59:31 +09:00

View file

@ -149,7 +149,7 @@ static ErrorOr<ByteBuffer> planar_to_chunky(ReadonlyBytes bitplanes, ILBMLoading
u16 width = context.bm_header.width;
u16 height = context.bm_header.height;
u8 planes = context.bm_header.planes;
auto chunky = TRY(ByteBuffer::create_zeroed(width * height));
auto chunky = TRY(ByteBuffer::create_zeroed(static_cast<size_t>(width) * height));
for (u16 y = 0; y < height; y++) {
size_t scanline = y * width;