mirror of
https://github.com/facebook/zstd.git
synced 2025-11-30 11:21:33 +03: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:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user