mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:47:35 +00:00
LibGfx: Return from scan_huffman_stream
before JPEG_EOI
As a JPEG file can contain multiples scans, we should return from `scan_huffman_stream` on all new markers (except restart markers) and not only `JPEG_EOI`.
This commit is contained in:
parent
f1aa189027
commit
c0c48afe06
1 changed files with 4 additions and 4 deletions
|
@ -1217,15 +1217,15 @@ static ErrorOr<void> scan_huffman_stream(AK::SeekableStream& stream, JPEGLoading
|
|||
continue;
|
||||
}
|
||||
Marker marker = 0xFF00 | current_byte;
|
||||
if (marker == JPEG_EOI)
|
||||
return {};
|
||||
if (marker >= JPEG_RST0 && marker <= JPEG_RST7) {
|
||||
context.huffman_stream.stream.append(marker);
|
||||
current_byte = TRY(stream.read_value<u8>());
|
||||
continue;
|
||||
}
|
||||
dbgln_if(JPEG_DEBUG, "{}: Invalid marker: {:x}!", TRY(stream.tell()), marker);
|
||||
return Error::from_string_literal("Invalid marker");
|
||||
|
||||
// Rollback the marker we just read
|
||||
TRY(stream.seek(-2, AK::SeekMode::FromCurrentPosition));
|
||||
return {};
|
||||
} else {
|
||||
context.huffman_stream.stream.append(last_byte);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue