serenity/Userland/Libraries/LibCompress
Idan Horowitz b749167506 LibCompress: Fix off-by-one error in generate_huffman_lengths
Previously we would calculate the index of the first parent node as
heap.size() (which is initialized to non_zero_freqs), so in the edge
case in which all symbols had a non-zero frequency, we would use the
Size-index entry in the array for both the first symbol's leaf node,
and the first parent node.

The result would either be a non-optimal huffman code (bad), or an
illegal huffman code that would then go on to crash due to an error
check in CanonicalCode::from_bytes. (worse)

We now store parent nodes starting at heap.size() - 1, which eliminates
the potential overlap, and resolves the issue.
2023-12-04 00:06:38 +01:00
..
Brotli.cpp
Brotli.h
BrotliDictionary.cpp
BrotliDictionary.h
BrotliDictionaryData.bin
CMakeLists.txt
Deflate.cpp LibCompress: Fix off-by-one error in generate_huffman_lengths 2023-12-04 00:06:38 +01:00
Deflate.h
DeflateTables.h
Gzip.cpp
Gzip.h
Lzma.cpp
Lzma.h AK: Rename GenericTraits to DefaultTraits 2023-11-09 10:05:51 -05:00
Lzma2.cpp
Lzma2.h
LZWDecoder.h LibCompress: Add LZWDecoder::decode_all() 2023-12-01 12:58:14 +01:00
Xz.cpp LibCompress: Implement correct validation of last filters 2023-10-29 22:00:59 +01:00
Xz.h AK: Rename GenericTraits to DefaultTraits 2023-11-09 10:05:51 -05:00
Zlib.cpp
Zlib.h AK: Rename GenericTraits to DefaultTraits 2023-11-09 10:05:51 -05:00