]> git.ipfire.org Git - thirdparty/zstd.git/commit
[fuzz] Only set HUF_repeat_valid if loaded table has all non-zero weights (#1898)
authorBimba Shrestha <bimbashrestha@fb.com>
Tue, 26 Nov 2019 20:24:19 +0000 (12:24 -0800)
committerNick Terrell <terrelln@fb.com>
Tue, 26 Nov 2019 20:24:19 +0000 (12:24 -0800)
commita3a3c62b81ef41fc3edbc991c165ff0acd3a29be
treed6dd58d9e50a570fb648bbc0e4b6e545fcaa5907
parentd6e0a44576feb3da8858eed8454407f27c20a338
[fuzz] Only set HUF_repeat_valid if loaded table has all non-zero weights (#1898)

Fixes a fuzz issue where dictionary_round_trip failed because the compressor was generating corrupt files thanks to zero weights in the table.

* Only setting loaded dict huf table to valid on non-zero

* Adding hasNoZeroWeights test to fse tables

* Forbiding nbBits != 0 when weight == 0

* Reverting the last commit

* Setting table log to 0 when weight == 0

* Small (invalid) zero weight dict test

* Small (valid) zero weight dict test

* Initializing repeatMode vars to check before zero check

* Removing FSE changes to seperate pr

* Reverting accidentally changed file

* Negating bool, using unsigned, optimization nit
lib/common/huf.h
lib/compress/huf_compress.c
lib/compress/zstd_compress.c
tests/dict-files/zero-weight-dict [new file with mode: 0644]
tests/playTests.sh