]> git.ipfire.org Git - thirdparty/zstd.git/commit
[libzstd] Fix bug in Huffman decompresser 778/head
authorNick Terrell <terrelln@fb.com>
Fri, 28 Jul 2017 18:54:28 +0000 (11:54 -0700)
committerNick Terrell <terrelln@fb.com>
Mon, 7 Aug 2017 19:37:48 +0000 (12:37 -0700)
commitabe12b339994a15cd176df65ceb3a5345e2d47aa
tree2f2b7f1d76e5c77e0e5a59b370209deb8853ef37
parente1222544be16a50b9309c6dbc8fcc41319a0ae5a
[libzstd] Fix bug in Huffman decompresser

The zstd format specification doesn't enforce that Huffman compressed
literals (including the table) have to be smaller than the uncompressed
literals. The compressor will never Huffman compress literals if the
compressed size is larger than the uncompressed size. The decompresser
doesn't accept Huffman compressed literals with 4 streams whose compressed
size is at least as large as the uncompressed size.

* Make the decompresser accept Huffman compressed literals whose size
  increases.
* Add a test case that exposes the bug. The compressed file has to be
  statically generated, since the compressor won't normally produce files
  that expose the bug.
lib/decompress/huf_decompress.c
tests/files/huffman-compressed-larger [new file with mode: 0644]
tests/playTests.sh