LibGfx: Reject GIFs with ridiculously large symbols

This also prevents exploitation by malicious GIFs.
Found by OSS Fuzz, long-standing issue
(since 259f8541fc)
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29034
This commit is contained in:
Ben Wiederhake 2021-05-30 20:03:32 +02:00 committed by Andreas Kling
commit 7224308358
Notes: sideshowbarker 2024-07-18 04:47:06 +09:00

View file

@ -335,6 +335,9 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index)
copy_frame_buffer(*context.frame_buffer, *context.prev_frame_buffer);
}
if (image.lzw_min_code_size > 8)
return false;
LZWDecoder decoder(image.lzw_encoded_bytes, image.lzw_min_code_size);
// Add GIF-specific control codes