]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed repcode bug
authorYann Collet <yann.collet.73@gmail.com>
Tue, 17 Nov 2015 11:23:53 +0000 (12:23 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Tue, 17 Nov 2015 11:23:53 +0000 (12:23 +0100)
lib/zstd_compress.c

index a128ed8cca0802472c7dd7965e70e9c2763f5026..95a6e774ad429b304b1cd06aeada1065c167c2f2 100644 (file)
@@ -863,7 +863,7 @@ size_t ZSTD_compressBlock_fast_extDict_generic(ZSTD_CCtx* ctx,
 
         {
             size_t litLength = ip-anchor;
-            size_t maxLength = MIN((size_t)(iend-ip-MINMATCH), (size_t)(dictLimit - matchIndex));   /* works even if matchIndex > dictLimit */
+            size_t maxLength = matchIndex < dictLimit ?  MIN((size_t)(iend-ip-MINMATCH), (size_t)(dictLimit - matchIndex))  :  (size_t)(iend-ip-MINMATCH);
             const BYTE* const iEndCount = ip + maxLength;
             size_t matchLength = ZSTD_count(ip+MINMATCH, match+MINMATCH, iEndCount);
             size_t offsetCode = current-matchIndex;