From 62cb52b3410bdfd696669910de010ab03666edc8 Mon Sep 17 00:00:00 2001 From: "W. Felix Handte" Date: Mon, 12 Feb 2018 12:10:15 -0500 Subject: [PATCH] Initialize Current Offset to 1 --- lib/lz4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/lz4.c b/lib/lz4.c index d558b3b..dde27e9 100644 --- a/lib/lz4.c +++ b/lib/lz4.c @@ -550,7 +550,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( tableType == byPtr); size_t currentOffset = ((tableType == byU32 || tableType == byU16) && - !resetTable) ? cctx->currentOffset : 0; + !resetTable) ? cctx->currentOffset : 1; const BYTE* base = (const BYTE*) source - currentOffset; const BYTE* lowLimit; const BYTE* const lowRefLimit = ip - cctx->dictSize; @@ -593,7 +593,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( if (resetTable) { DEBUGLOG(4, "Resetting table in %p", cctx); MEM_INIT(cctx->hashTable, 0, LZ4_HASHTABLESIZE); - cctx->currentOffset = 0; + cctx->currentOffset = 1; } if (inputSizeinternal_donotuse.currentOffset = 0; + ctxPtr->internal_donotuse.currentOffset = 1; #else LZ4_stream_t ctx; LZ4_stream_t* const ctxPtr = &ctx; @@ -1039,7 +1039,7 @@ void LZ4_resetStream (LZ4_stream_t* LZ4_stream) { DEBUGLOG(5, "LZ4_resetStream %p", LZ4_stream); MEM_INIT(LZ4_stream, 0, sizeof(LZ4_stream_t)); - LZ4_stream->internal_donotuse.currentOffset = 0; + LZ4_stream->internal_donotuse.currentOffset = 1; LZ4_stream->internal_donotuse.tableType = unusedTable; }