mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
LibGfx/JPEG: Don't return an error on empty icc profiles
An empty icc profile shouldn't stop our brave decoder.
This commit is contained in:
parent
7551666a80
commit
243e91f5de
Notes:
sideshowbarker
2024-07-16 20:39:14 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/243e91f5de Pull-request: https://github.com/SerenityOS/serenity/pull/19573 Reviewed-by: https://github.com/nico ✅
1 changed files with 5 additions and 2 deletions
|
@ -1030,8 +1030,11 @@ static ErrorOr<void> read_huffman_table(JPEGStream& stream, JPEGLoadingContext&
|
|||
static ErrorOr<void> read_icc_profile(JPEGStream& stream, JPEGLoadingContext& context, int bytes_to_read)
|
||||
{
|
||||
// https://www.color.org/technotes/ICC-Technote-ProfileEmbedding.pdf, page 5, "JFIF".
|
||||
if (bytes_to_read <= 2)
|
||||
return Error::from_string_literal("icc marker too small");
|
||||
if (bytes_to_read <= 2) {
|
||||
dbgln_if(JPEG_DEBUG, "icc marker too small");
|
||||
TRY(stream.discard(bytes_to_read));
|
||||
return {};
|
||||
}
|
||||
|
||||
auto chunk_sequence_number = TRY(stream.read_u8()); // 1-based
|
||||
auto number_of_chunks = TRY(stream.read_u8());
|
||||
|
|
Loading…
Reference in a new issue