]> git.ipfire.org Git - thirdparty/zstd.git/commit
[opt] Fix too short of match getting generated
authorNick Terrell <terrelln@meta.com>
Fri, 20 Dec 2024 22:32:28 +0000 (17:32 -0500)
committerNick Terrell <nickrterrell@gmail.com>
Fri, 3 Jan 2025 16:38:41 +0000 (11:38 -0500)
commit1548bfc3497f45399daab58bcec4ab06a0878af1
treee6e4af4c953f673b17516fb801607f87852eef63
parent2759d9d52fd2b50d7ae3f4563797acc641928550
[opt] Fix too short of match getting generated

The optimal parser with LDM enabled using minMatch > 3 could generate a match
length of 3 when minMatch >= 4. This is not allowed.

1. Fix the bug
2. Add validation logic to `ZSTD_buildSeqStore()` in debug mode for all block
   compressors that checks we never generate too short a match. This way we don't
   rely on the `generate_sequences` fuzzer to find this issue.

Credit to OSS-Fuzz
lib/compress/zstd_compress.c
lib/compress/zstd_opt.c