]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed ZSTD_compressBlock_opt_extDict_generic 267/head
authorinikep <inikep@gmail.com>
Sun, 31 Jul 2016 18:08:53 +0000 (20:08 +0200)
committerinikep <inikep@gmail.com>
Sun, 31 Jul 2016 18:08:53 +0000 (20:08 +0200)
lib/compress/zstd_opt.h

index 9496ed358851dd891b4f232ee9fd143b2464b36b..b7970bdb75f620ec7e21e6df0f697dfa6455502a 100644 (file)
@@ -782,7 +782,7 @@ void ZSTD_compressBlock_opt_extDict_generic(ZSTD_CCtx* ctx,
                 const U32 repIndex = (U32)(current - rep[i]);
                 const BYTE* const repBase = repIndex < dictLimit ? dictBase : base;
                 const BYTE* const repMatch = repBase + repIndex;
-                if ((rep[i]<(U32)(ip-prefixStart))
+                if ( (rep[i] <= current)
                    && (((U32)((dictLimit-1) - repIndex) >= 3) & (repIndex>lowestIndex))  /* intentional overflow */
                    && (MEM_readMINMATCH(ip, minMatch) == MEM_readMINMATCH(repMatch, minMatch)) ) {
                     /* repcode detected we should take it */
@@ -885,7 +885,7 @@ void ZSTD_compressBlock_opt_extDict_generic(ZSTD_CCtx* ctx,
                     const U32 repIndex = (U32)(current+cur - opt[cur].rep[i]);
                     const BYTE* const repBase = repIndex < dictLimit ? dictBase : base;
                     const BYTE* const repMatch = repBase + repIndex;
-                    if ((opt[cur].rep[i]<(U32)(ip-prefixStart))
+                    if ( (opt[cur].rep[i] <= current+cur)
                       && (((U32)((dictLimit-1) - repIndex) >= 3) & (repIndex>lowestIndex))  /* intentional overflow */
                       && (MEM_readMINMATCH(inr, minMatch) == MEM_readMINMATCH(repMatch, minMatch)) ) {
                         /* repcode detected */