Merge pull request #616 from felixhandte/lz4-attach-reject-short-dicts

Fix LZ4_compress_fast_continue() Prefix Size Check
This commit is contained in:
Yann Collet 2018-12-09 11:29:43 -08:00 committed by GitHub
commit 16400fb790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1319,7 +1319,7 @@ int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, const char* source, ch
if (acceleration < 1) acceleration = ACCELERATION_DEFAULT;
/* invalidate tiny dictionaries */
if ( (streamPtr->dictSize-1 < 4) /* intentional underflow */
if ( (streamPtr->dictSize-1 < 4-1) /* intentional underflow */
&& (dictEnd != (const BYTE*)source) ) {
DEBUGLOG(5, "LZ4_compress_fast_continue: dictSize(%u) at addr:%p is too small", streamPtr->dictSize, streamPtr->dictionary);
streamPtr->dictSize = 0;