]> git.ipfire.org Git - thirdparty/zstd.git/commit
[lib] Fix dictionary invalidation logic
authorNick Terrell <terrelln@fb.com>
Thu, 13 May 2021 23:13:29 +0000 (16:13 -0700)
committerNick Terrell <terrelln@fb.com>
Fri, 14 May 2021 00:05:59 +0000 (17:05 -0700)
commit03c411129909eac5386b294b058a3f4c1f633315
tree429bb54ab9ea32c5cd355a2a5cf82aa34ff3a80e
parent10b35b312b0280674c02b9c9227e2fff766410a9
[lib] Fix dictionary invalidation logic

Call `ZSTD_enforceMaxDist()` before each block with the beginning of the
block. This ensures that `lowLimit` is updated to `dictLimit` whenever
the ext-dict is out of range, so we can use prefix mode for speed.

This can cause non-determinism because prefix mode and ext-dict mode
match finders can return different results. It can also hurt speed
because ext-dict match finders are slower.

The scenario is:
1. Compress large data with a dictionary.
2. The dictionary goes out of bounds, so we invalidate it.
3. However, we still have `lowLimit < dictLimit`, since it is
   never updated.
4. We will call the ext-dict match finder instead of the prefix one.
lib/compress/zstd_compress.c