]> git.ipfire.org Git - thirdparty/zstd.git/commit
fix : huge (>4GB) stream of blocks
authorYann Collet <cyan@fb.com>
Wed, 26 Sep 2018 21:24:28 +0000 (14:24 -0700)
committerYann Collet <cyan@fb.com>
Wed, 26 Sep 2018 21:24:28 +0000 (14:24 -0700)
commitf98c69d77cd9b1dde60df2de05613006842d4896
treeca4a8c5318f5565666700c5670f3ea333da5d825
parent9bb6c15f7966f59d001f782f087484a414eba570
fix : huge (>4GB) stream of blocks

experimental function ZSTD_compressBlock() is designed for very small data in mind,
for situation where saving the ~12 bytes of frame header can actually make a difference.

Some systems though may have to deal with small and large data entangled.
If it's larger than a block (> 128KB), compressBlock() cannot compress them in one round.

That's why it's possible to compress in multiple rounds.
This is a chain of compressed blocks.

Some users push this capability to the limit, encoding gigantic chain of blocks.
On crossing the 4GB limit, some internal overflow occurs.

This fix moves the overflow correction mechanism higher in the call chain,
so that it's applied also to gigantic chains of blocks.

Added a test case in fuzzer.c, which crashes before the fix, and pass now.
lib/compress/zstd_compress.c
lib/compress/zstd_fast.c
tests/fuzzer.c