Android security tags, read closely by Lightrion

CVE-2023-4863 AI-generated analysis

platform/external/webp, libwebp VP8L lossless decoder (src/dec/vp8l_dec.c, src/utils/huffman_utils.c)

AI-generated: written from the bulletin and the fixing diffs by claude-fable-5-1, then checked against the code by claude-opus-5-5 (5 corrections). Verify against the commit before relying on it.

The fixed-size HuffmanCode buffers in the VP8L (lossless WebP) decoder are replaced with a chained HuffmanTables segment structure. VP8LBuildHuffmanTable now does a dry run of BuildHuffmanTable to compute the exact table size and allocates a new segment when the current one is too small, so Huffman tables are no longer written past the allocated buffer.

Root cause

ReadHuffmanCodes in src/dec/vp8l_dec.c allocated one HuffmanCode array of num_htree_groups * table_size. It passed successive slices of that array to ReadHuffmanCode/VP8LBuildHuffmanTable, advancing by the size each call returned. ReadHuffmanCodeLengths used a stack array, HuffmanCode table[1 << LENGTHS_TABLE_BITS]. BuildHuffmanTable in src/utils/huffman_utils.c writes a root table plus second-level tables. Their total size depends on the code lengths in the bitstream: unbalanced codes produce more and larger second-level tables. BuildHuffmanTable wrote into root_table without checking the buffer size. The existing dry run with a NULL root_table could not be used to size the buffer, because the second-level loop did 'if (root_table == NULL) continue;'. According to the old header comment, a NULL root_table returned 0 or something greater than 0, not the table size. The commit title describes the result as an OOB write in BuildHuffmanTable.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to October 2023 · Findings