Don't size -= 1 in ZSTD_adjustCParams()

The window size could end up too small if the source size is 2^n + 1.

Credit to OSS-Fuzz
This commit is contained in:
Nick Terrell 2017-09-30 14:17:32 -07:00
parent ee1ed78fcb
commit c5d6dde502

View File

@ -651,7 +651,7 @@ ZSTD_compressionParameters ZSTD_adjustCParams_internal(ZSTD_compressionParameter
if (dictSize && (srcSize+1<2) /* srcSize unknown */ )
srcSize = minSrcSize; /* presumed small when there is a dictionary */
else
else if (srcSize == 0)
srcSize -= 1; /* unknown 0 => -1ULL : presumed large */
/* resize windowLog if input is small enough, to use less memory */