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

LibGfx/JPEG: Discard the correct number of bytes

This path has never been tested as it requires a non-standard APP
segment. We (un?)fortunately found one, and it exposed a silly bug.
This commit is contained in:
Lucas CHOLLET 2023-05-08 12:19:22 -04:00 committed by Andreas Kling
parent 5896f4c400
commit e81baa0464

View file

@ -1042,8 +1042,8 @@ static ErrorOr<void> read_colour_encoding(Stream& stream, [[maybe_unused]] JPEGL
auto const color_transform = TRY(stream.read_value<u8>()); auto const color_transform = TRY(stream.read_value<u8>());
if (bytes_to_read > 6) { if (bytes_to_read > 6) {
dbgln_if(JPEG_DEBUG, "Unread bytes in App14 segment: {}", bytes_to_read - 1); dbgln_if(JPEG_DEBUG, "Unread bytes in App14 segment: {}", bytes_to_read - 6);
TRY(stream.discard(bytes_to_read - 1)); TRY(stream.discard(bytes_to_read - 6));
} }
switch (color_transform) { switch (color_transform) {