With a specially crafted WebP lossless file, libwebp may write data out of bounds to the heap.
The ReadHuffmanCodes() function allocates the HuffmanCode buffer with a size that comes from an array of precomputed sizes: kTableSize. The color_cache_bits value defines which size to use.
The kTableSize array only takes into account sizes for 8-bit first-level table lookups but not second-level table lookups. libwebp allows codes that are up to 15-bit (MAX_ALLOWED_CODE_LENGTH). When BuildHuffmanTable() attempts to fill the second-level tables it may write data out-of-bounds. The OOB write to the undersized array happens in ReplicateValue.
OS | Version | Architecture | Package | Version | Filename |
---|---|---|---|---|---|
Debian | 12 | all | libwebp | < 1.2.4-0.2+deb12u1 | libwebp_1.2.4-0.2+deb12u1_all.deb |
Debian | 11 | all | libwebp | < 0.6.1-2.1+deb11u2 | libwebp_0.6.1-2.1+deb11u2_all.deb |
Debian | 10 | all | libwebp | < 0.6.1-2+deb10u3 | libwebp_0.6.1-2+deb10u3_all.deb |
Debian | 999 | all | libwebp | < 1.2.4-0.3 | libwebp_1.2.4-0.3_all.deb |