mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 23:25:20 +00:00
LibGfx/WebP: Check ICCP chunk precedes alpha and animation frame chunks
This commit is contained in:
committed by
Andreas Kling
parent
41d518669e
commit
03b04ed66a
@@ -1454,9 +1454,12 @@ static ErrorOr<void> decode_webp_extended(WebPLoadingContext& context, ReadonlyB
|
||||
|
||||
// https://developers.google.com/speed/webp/docs/riff_container#color_profile
|
||||
// "This chunk MUST appear before the image data."
|
||||
// FIXME: Doesn't check animated files.
|
||||
if (context.iccp_chunk.has_value() && context.image_data_chunk.has_value() && context.iccp_chunk->data.data() > context.image_data_chunk->data.data())
|
||||
if (context.iccp_chunk.has_value()
|
||||
&& ((context.image_data_chunk.has_value() && context.iccp_chunk->data.data() > context.image_data_chunk->data.data())
|
||||
|| (context.alpha_chunk.has_value() && context.iccp_chunk->data.data() > context.alpha_chunk->data.data())
|
||||
|| (!context.animation_frame_chunks.is_empty() && context.iccp_chunk->data.data() > context.animation_frame_chunks[0].data.data()))) {
|
||||
return context.error("WebPImageDecoderPlugin: ICCP chunk is after image data");
|
||||
}
|
||||
|
||||
context.state = WebPLoadingContext::State::ChunksDecoded;
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user