deal safely with short inputs in ZSTD_ldm_generateSequences
The fuzzer CI found this bug.
This commit is contained in:
@@ -328,6 +328,9 @@ static size_t ZSTD_ldm_generateSequences_internal(
|
|||||||
} candidates[LDM_LOOKAHEAD_SPLITS];
|
} candidates[LDM_LOOKAHEAD_SPLITS];
|
||||||
unsigned numSplits;
|
unsigned numSplits;
|
||||||
|
|
||||||
|
if (srcSize < minMatchLength)
|
||||||
|
return iend - anchor;
|
||||||
|
|
||||||
/* Initialize the rolling hash state with the first minMatchLength bytes */
|
/* Initialize the rolling hash state with the first minMatchLength bytes */
|
||||||
ZSTD_ldm_gear_init(&hashState, params);
|
ZSTD_ldm_gear_init(&hashState, params);
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user