From ae1f7124acca7963e3c90f0e54894b9b3715e0a1 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 5 Apr 2023 15:03:52 -0400 Subject: [PATCH] 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. --- Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp index 0aea8ea57f..00f94ff864 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp @@ -435,7 +435,7 @@ static ErrorOr 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 const alphabet_sizes { 256 + 24 + static_cast(color_cache_size), 256, 256, 256, 40 }; + Array const alphabet_sizes { 256 + 24 + static_cast(color_cache_size), 256, 256, 256, 40 }; PrefixCodeGroup group; for (size_t i = 0; i < alphabet_sizes.size(); ++i)