diff --git a/lib/lz4.c b/lib/lz4.c index 980a5fd..dca4d69 100644 --- a/lib/lz4.c +++ b/lib/lz4.c @@ -588,12 +588,12 @@ LZ4_FORCE_INLINE void LZ4_prepareTable( || tableType == byPtr || inputSize >= 4 KB) { - DEBUGLOG(4, "Resetting table in %p", cctx); + DEBUGLOG(4, "LZ4_prepareTable: Resetting table in %p", cctx); MEM_INIT(cctx->hashTable, 0, LZ4_HASHTABLESIZE); cctx->currentOffset = 0; cctx->tableType = clearedTable; } else { - DEBUGLOG(4, "Re-use hash table (no reset)"); + DEBUGLOG(4, "LZ4_prepareTable: Re-use hash table (no reset)"); } } @@ -799,13 +799,13 @@ _next_match: /* Encode Offset */ if (maybe_ext_memSegment) { /* static test */ + DEBUGLOG(6, " with offset=%u (ext if > %i)", offset, (int)(ip - (const BYTE*)source)); assert(offset <= MAX_DISTANCE && offset > 0); LZ4_writeLE16(op, (U16)offset); op+=2; - DEBUGLOG(6, " with offset=%u (ext if > %i)", offset, (int)(ip - (const BYTE*)source)); } else { + DEBUGLOG(6, " with offset=%u (same segment)", (U32)(ip - match)); assert(ip-match <= MAX_DISTANCE); LZ4_writeLE16(op, (U16)(ip - match)); op+=2; - DEBUGLOG(6, " with offset=%u (same segment)", (U32)(ip - match)); } /* Encode MatchLength */ @@ -823,11 +823,11 @@ _next_match: matchCode += more; ip += more; } - DEBUGLOG(6, " with matchLength=%u starting in extDict", matchCode+MINMATCH); + DEBUGLOG(6, " with matchLength=%u starting in extDict", matchCode+MINMATCH); } else { matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit); ip += MINMATCH + matchCode; - DEBUGLOG(6, " with matchLength=%u", matchCode+MINMATCH); + DEBUGLOG(6, " with matchLength=%u", matchCode+MINMATCH); } if ( outputLimited && /* Check output buffer overflow */ @@ -1259,7 +1259,7 @@ LZ4_stream_t* LZ4_createStream(void) void LZ4_resetStream (LZ4_stream_t* LZ4_stream) { - DEBUGLOG(5, "LZ4_resetStream %p", LZ4_stream); + DEBUGLOG(5, "LZ4_resetStream (ctx:%p)", LZ4_stream); MEM_INIT(LZ4_stream, 0, sizeof(LZ4_stream_t)); } diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 7721345..244cc4f 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -687,19 +687,19 @@ static int FUZ_test(U32 seed, U32 nbCycles, const U32 startCycle, const double c } } /* Compress using external dictionary stream */ - FUZ_DISPLAYTEST(); { LZ4_stream_t LZ4_stream; int expectedSize; U32 expectedCrc; + FUZ_DISPLAYTEST("LZ4_compress_fast_continue() after LZ4_loadDict()"); LZ4_loadDict(&LZ4dict, dict, dictSize); expectedSize = LZ4_compress_fast_continue(&LZ4dict, block, compressedBuffer, blockSize, (int)compressedBufferSize, 1); FUZ_CHECKTEST(expectedSize<=0, "LZ4_compress_fast_continue reference compression for extDictCtx should have succeeded"); expectedCrc = XXH32(compressedBuffer, expectedSize, 0); + FUZ_DISPLAYTEST("LZ4_compress_fast_continue() after LZ4_attach_dictionary()"); LZ4_loadDict(&LZ4dict, dict, dictSize); - LZ4_resetStream(&LZ4_stream); LZ4_attach_dictionary(&LZ4_stream, &LZ4dict); blockContinueCompressedSize = LZ4_compress_fast_continue(&LZ4_stream, block, compressedBuffer, blockSize, (int)compressedBufferSize, 1); @@ -713,7 +713,7 @@ static int FUZ_test(U32 seed, U32 nbCycles, const U32 startCycle, const double c FUZ_CHECKTEST(blockContinueCompressedSize != expectedSize, "LZ4_compress_fast_continue using extDictCtx produced different-sized output (%d expected vs %d actual)", expectedSize, blockContinueCompressedSize); FUZ_CHECKTEST(XXH32(compressedBuffer, blockContinueCompressedSize, 0) != expectedCrc, "LZ4_compress_fast_continue using extDictCtx produced different output"); - FUZ_DISPLAYTEST(); + FUZ_DISPLAYTEST("LZ4_compress_fast_continue() after LZ4_attach_dictionary(), but output buffer is 1 byte too short"); LZ4_resetStream(&LZ4_stream); LZ4_attach_dictionary(&LZ4_stream, &LZ4dict); ret = LZ4_compress_fast_continue(&LZ4_stream, block, compressedBuffer, blockSize, blockContinueCompressedSize-1, 1);