]> git.ipfire.org Git - thirdparty/zstd.git/commit
[zstd] Fix data corruption in niche use case
authorNick Terrell <terrelln@fb.com>
Fri, 21 Jun 2019 22:39:43 +0000 (15:39 -0700)
committerNick Terrell <terrelln@fb.com>
Fri, 21 Jun 2019 22:47:31 +0000 (15:47 -0700)
commit674534a700cc110b374f9c0a6c7f518e18392af2
treeb4d6b0cd0c792dfbec43d55f6da4c8eb976682b0
parent4156060ca498673b9938a512bc84d95a8a9c74b2
[zstd] Fix data corruption in niche use case

* Extract the overflow correction into a helper function.
* Load the dictionary `ZSTD_CHUNKSIZE_MAX = 512 MB` bytes at a time
  and overflow correct between each chunk.

Data corruption could happen when all these conditions are true:

* You are using multithreading mode
* Your overlap size is >= 512 MB (implies window size >= 512 MB)
* You are using a strategy >= ZSTD_btlazy
* You are compressing more than 4 GB

The problem is that when loading a large dictionary we don't do
overflow correction. We can only load 512 MB at a time, and may
need to do overflow correction before each chunk.
lib/compress/zstd_compress.c