]> git.ipfire.org Git - thirdparty/zstd.git/commit
[bug-fix] Fix a determinism bug with the DUBT 2726/head
authorNick Terrell <terrelln@fb.com>
Thu, 15 Jul 2021 19:14:44 +0000 (12:14 -0700)
committerNick Terrell <terrelln@fb.com>
Thu, 15 Jul 2021 20:02:49 +0000 (13:02 -0700)
commitba044bd6f12b22b3339731d6dc5a12476a24d1cc
treea361747fe3d64e142b7798519b8030664ed8749d
parentb18febe52c098198531643feacb15609a04f05e3
[bug-fix] Fix a determinism bug with the DUBT

The DUBT can be non-deterministic if an index is equal to
`ZSTD_DUBT_UNSORTED_MARK`. Ensure that never happens by starting the
indices at 2.

This bug was found by the OSS-Fuzz determinism fuzzer. With this change
the fuzzer test passes. And I've confirmed that this is the root cause,
not just hiding the problem.

Aside: This took me a long time to figure out, because I thought I had
tried this first thing. But, apparantly I messed it up, because when I
was going through it again with @felixhandte, I was pointing out that it
wasn't the case, but it turns out it was.

Credit to: OSS-Fuzz
lib/compress/zstd_compress_internal.h