]> git.ipfire.org Git - thirdparty/zstd.git/commit
Fix overflow protection with wlog=31 1035/head
authorNick Terrell <terrelln@fb.com>
Tue, 6 Mar 2018 21:07:28 +0000 (13:07 -0800)
committerNick Terrell <terrelln@fb.com>
Wed, 14 Mar 2018 18:45:44 +0000 (11:45 -0700)
commit33fb966e565831d1efaf3590d114597e5c0c2211
treea1f9d2a1d770200ffe58471e1efd1b3a59cbbe2b
parent4c5cbac179599f6de39361beee71b9548d13d207
Fix overflow protection with wlog=31

The overflow protection is broken when the window log is `> (3U << 29)`, so 31.
It doesn't work when `current` isn't around `1U << windowLog` ahead of `lowLimit`,
and the the assertion `current > newCurrent` fails. This happens when the same
context is used many times over, but with a large window log, like in zstdmt.

Fix it by triggering correction based on `nextSrc - base` instead of `lowLimit`.

The added test fails before the patch, and passes after.
lib/compress/zstd_compress.c
lib/compress/zstd_compress_internal.h
lib/compress/zstd_ldm.c
tests/fuzzer.c