]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed asan warning
authorYann Collet <yann.collet.73@gmail.com>
Fri, 30 Oct 2015 06:00:37 +0000 (07:00 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Fri, 30 Oct 2015 06:00:37 +0000 (07:00 +0100)
lib/zstdhc.c

index 9c70d79aa977333482c148fa154d30a5e12566c8..cc5a57c24b07704ad895ece6847f6a99db415f26 100644 (file)
@@ -213,7 +213,7 @@ static size_t ZSTD_HC_insertAndFindBestMatch (
                 && (MEM_read32(match) == MEM_read32(ip)))
             {
                 const size_t mlt = ZSTD_count(ip+MINMATCH, match+MINMATCH, iLimit) + MINMATCH;
-                if (mlt > ml) { ml = mlt; *matchpos = match; }
+                if (mlt > ml) { ml = mlt; *matchpos = match; if (ip+ml >= iLimit) break; }
             }
         }
         else