1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

LibGfx/ILBMLoader: Don't decode bits once full row has been decoded

We were potentially decoding more bits than needed: this could
trash the next lines if decoder didn't zero the extra bits.
This commit is contained in:
Nicolas Ramz 2024-01-12 18:26:52 +01:00 committed by Jelle Raaijmakers
parent d545fb2b60
commit a1255cb6c9
3 changed files with 14 additions and 1 deletions

View file

@ -220,7 +220,9 @@ static ErrorOr<ByteBuffer> planar_to_chunky(ReadonlyBytes bitplanes, ILBMLoading
u8 bit = bitplanes[offset_base + i];
u8 rgb_shift = p / 8;
for (u8 b = 0; b < 8; b++) {
// Some encoders don't pad bytes rows with 0: make sure we stop
// when enough data for current bitplane row has been read
for (u8 b = 0; b < 8 && (i * 8) + b < width; b++) {
u8 mask = 1 << (7 - b);
// get current plane
if (bit & mask) {