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

LibGfx: Correctly handle more than one PrefixCodeGroup in webp decoder

The `static` here meant we always kept the alphabet sizes of the
first image we happened to load -- and a single webp lossless image
can store several helper images used during decoding.

Usually, the helper images wouldn't use a color cache but the main
image would, but the main image would then use the first entry from
the helper images due to the `static`, which led us to not decoding
the codes for the color cache symbols.
This commit is contained in:
Nico Weber 2023-04-05 15:03:52 -04:00 committed by Linus Groh
parent 4d87072201
commit ae1f7124ac

View file

@ -435,7 +435,7 @@ static ErrorOr<PrefixCodeGroup> decode_webp_chunk_VP8L_prefix_code_group(WebPLoa
// * G channel: 256 + 24 + color_cache_size
// * other literals (A,R,B): 256
// * distance code: 40"
static Array<size_t, 5> const alphabet_sizes { 256 + 24 + static_cast<size_t>(color_cache_size), 256, 256, 256, 40 };
Array<size_t, 5> const alphabet_sizes { 256 + 24 + static_cast<size_t>(color_cache_size), 256, 256, 256, 40 };
PrefixCodeGroup group;
for (size_t i = 0; i < alphabet_sizes.size(); ++i)