]> git.ipfire.org Git - thirdparty/zstd.git/commit
Determinism: Avoid Mapping Window into Reserved Indices during Reduction 2869/head
authorW. Felix Handte <w@felixhandte.com>
Wed, 17 Nov 2021 23:09:18 +0000 (18:09 -0500)
committerW. Felix Handte <w@felixhandte.com>
Wed, 17 Nov 2021 23:09:18 +0000 (18:09 -0500)
commit66079085f06c526e55e3f97cbe17d04d11960698
treec75ce0553a657d3a054c5a22fea3d998da5537cc
parentddae153947beb03b9c9b64dc0ecf43b37e924e4d
Determinism: Avoid Mapping Window into Reserved Indices during Reduction

PR #2850 attempted to fix a determinism bug that was uncovered by OSS-Fuzz. It
succeeded in addressing that source of non-determinism, but introduced a new
one: it was possible, when index reduction occurred, to map indices in the
window to the reserved value, which would cause them to be zeroed, potentially
altering parsing of the input.

This PR addresses this issue. It makes sure that the bottom of the window is
always `>= ZSTD_WINDOW_START_INDEX`.

I'm not sure if this makes #2850 redundant. I think it's probably still
valuable to have that protection as well.

Credit to OSS-Fuzz for discovering this issue.
lib/compress/zstd_compress_internal.h