]> git.ipfire.org Git - thirdparty/zstd.git/commit
[rsyncable] Ensure ZSTD_compressBound() is respected 2776/head
authorNick Terrell <terrelln@fb.com>
Mon, 13 Sep 2021 23:59:20 +0000 (16:59 -0700)
committerNick Terrell <terrelln@fb.com>
Tue, 14 Sep 2021 00:14:07 +0000 (17:14 -0700)
commita418b4e4787f495abcc1f2e7768bd52a8d5ffc82
treedca50bc75e01a5d5d3989acaf5dcb940717fb85e
parentc10067c44e1349d699641d8ffb836e113952e8fe
[rsyncable] Ensure ZSTD_compressBound() is respected

In degenerate cases `--rsyncable` could create very small blocks (1
byte). This causes the compressed output to be larger than
`ZSTD_compressBound()`. Fix the issue by ensuring that rsyncable mode
never outputs blocks smaller than 128 KB.

The minimum job size is 512 KB, so we shouldn't lose many
synchronization points from skipping any that cause blocks smaller than
128 KB. And even if we do, that is fine, because we'll find the next
one.

This fixes the `raw_dictionary_round_trip` oss-fuzz assert.

Credit to OSS-Fuzz
lib/compress/zstdmt_compress.c