]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Apply Match Continuation Bug Fix
authorW. Felix Handte <w@felixhandte.com>
Wed, 6 Jun 2018 21:34:29 +0000 (17:34 -0400)
committerW. Felix Handte <w@felixhandte.com>
Wed, 13 Jun 2018 18:58:36 +0000 (14:58 -0400)
lib/compress/zstd_lazy.c

index 334d5dbc736c5e5b8f09ceb3ac3dbc835d075bf6..e9f5e1d35280214af469eda143d75bbf8ec14b49 100644 (file)
@@ -584,7 +584,7 @@ size_t ZSTD_compressBlock_lazy_generic(
             && ((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */)
             && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) {
             const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend;
-            matchLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, istart) + 4;
+            matchLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4;
             if (depth==0) goto _storeSequence;
         } else if ( dictMode == ZSTD_noDict
                  && ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1)))) {
@@ -676,7 +676,7 @@ _storeSequence:
                 if ( ((U32)((prefixLowestIndex-1) - (U32)repIndex2) >= 3 /* intentional overflow */)
                    && (MEM_read32(repMatch2) == MEM_read32(ip)) ) {
                     const BYTE* const repEnd2 = repIndex2 < prefixLowestIndex ? dictEnd : iend;
-                    matchLength = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, istart) + 4;
+                    matchLength = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixLowest) + 4;
                     offset = offset_2; offset_2 = offset_1; offset_1 = offset;   /* swap offset_2 <=> offset_1 */
                     ZSTD_storeSeq(seqStore, 0, anchor, 0, matchLength-MINMATCH);
                     ip += matchLength;