deal safely with short inputs in ZSTD_ldm_generateSequences

The fuzzer CI found this bug.
This commit is contained in:
Quentin Carbonneaux
2021-02-04 11:15:24 +01:00
parent 9f327c02fd
commit 874a590e5c
+3
View File
@@ -328,6 +328,9 @@ static size_t ZSTD_ldm_generateSequences_internal(
} candidates[LDM_LOOKAHEAD_SPLITS];
unsigned numSplits;
if (srcSize < minMatchLength)
return iend - anchor;
/* Initialize the rolling hash state with the first minMatchLength bytes */
ZSTD_ldm_gear_init(&hashState, params);
{