libarchive: Backport "Fix use of uninitialized values from Huffman table"

Backport libarchive commit `1f5454575f` (cab reader: Fix use of
uninitialized values from Huffman, 2026-04-23).

Add a fuzzing test case to expose this to dynamic analysis tools.
This commit is contained in:
Tyler Yankee
2026-04-26 18:25:06 -04:00
parent 32c6789651
commit 86dfdbee1f
2 changed files with 4 additions and 0 deletions
Binary file not shown.
@@ -3201,6 +3201,10 @@ lzx_make_huffman_table(struct huffman *hf)
bitlen = hf->bitlen; bitlen = hf->bitlen;
len_avail = hf->len_size; len_avail = hf->len_size;
hf->tree_used = 0; hf->tree_used = 0;
/* Initialize table to invalid values */
for (i = 0; i < tbl_size; i++) {
tbl[i] = (uint16_t)hf->len_size;
}
for (i = 0; i < len_avail; i++) { for (i = 0; i < len_avail; i++) {
uint16_t *p; uint16_t *p;
int len, cnt; int len, cnt;