]> git.ipfire.org Git - thirdparty/zstd.git/commit
Fix & fuzz ZSTD_generateSequences 3981/head
authorNick Terrell <terrelln@fb.com>
Tue, 19 Mar 2024 19:37:55 +0000 (12:37 -0700)
committerNick Terrell <terrelln@fb.com>
Thu, 21 Mar 2024 14:18:05 +0000 (07:18 -0700)
commit731f4b70fcd22fc9badd4e51dc6d939ee6da6c54
treeeae8e96041a3cdfd70014408577665728c7bd387
parent741b87bbe1c7c7e7292742f3b1ed9c4055c4743c
Fix & fuzz ZSTD_generateSequences

This function was seriously flawed:
* It didn't do output bounds checks
* It produced invalid sequences when an uncompressed or RLE block was emitted
* It produced invalid sequences when the block splitter was enabled
* It produced invalid sequences when ZSTD_c_targetCBlockSize was enabled

I've attempted to fix these issues, but this function is just a bad idea,
so I've marked it as deprecated and unsafe. We should replace it with
`ZSTD_extractSequences()` which operates on a compressed frame.
CHANGELOG
lib/compress/zstd_compress.c
lib/compress/zstdmt_compress.c
lib/zstd.h
tests/fuzz/Makefile
tests/fuzz/fuzz.py
tests/fuzz/generate_sequences.c [new file with mode: 0644]
tests/fuzzer.c