mirror of
https://github.com/facebook/zstd.git
synced 2025-10-11 00:03:06 -04:00
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:
parent
ee1ed78fcb
commit
c5d6dde502
@ -651,7 +651,7 @@ ZSTD_compressionParameters ZSTD_adjustCParams_internal(ZSTD_compressionParameter
|
|||||||
|
|
||||||
if (dictSize && (srcSize+1<2) /* srcSize unknown */ )
|
if (dictSize && (srcSize+1<2) /* srcSize unknown */ )
|
||||||
srcSize = minSrcSize; /* presumed small when there is a dictionary */
|
srcSize = minSrcSize; /* presumed small when there is a dictionary */
|
||||||
else
|
else if (srcSize == 0)
|
||||||
srcSize -= 1; /* unknown 0 => -1ULL : presumed large */
|
srcSize -= 1; /* unknown 0 => -1ULL : presumed large */
|
||||||
|
|
||||||
/* resize windowLog if input is small enough, to use less memory */
|
/* resize windowLog if input is small enough, to use less memory */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user