[LZ4_compress_destSize] Fix off-by-one error in fix

The next match is looking at the current ip, not the next ip,
so it needs to be cleared as well.

Credit to OSS-Fuzz
This commit is contained in:
Nick Terrell 2019-07-18 12:20:29 -07:00
parent 19b099986a
commit 7c32101c65

View File

@ -1042,7 +1042,7 @@ _next_match:
*/ */
const BYTE* ptr; const BYTE* ptr;
DEBUGLOG(5, "Clearing %u positions", (U32)(filledIp - ip)); DEBUGLOG(5, "Clearing %u positions", (U32)(filledIp - ip));
for (ptr = ip + 1; ptr <= filledIp; ++ptr) { for (ptr = ip; ptr <= filledIp; ++ptr) {
U32 const h = LZ4_hashPosition(ptr, tableType); U32 const h = LZ4_hashPosition(ptr, tableType);
LZ4_clearHash(h, cctx->hashTable, tableType); LZ4_clearHash(h, cctx->hashTable, tableType);
} }