]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed roll buffer greedy mode
authorYann Collet <yann.collet.73@gmail.com>
Sun, 22 Nov 2015 02:01:33 +0000 (03:01 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Sun, 22 Nov 2015 02:01:33 +0000 (03:01 +0100)
lib/zstd_compress.c

index e1a81dae183504b90462765ab34e0fa0215cd9e5..a599712bc24cc70ee2fe6b3cb98d8394d883d5b9 100644 (file)
@@ -1497,6 +1497,7 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx* ctx,
             const U32 repIndex = (U32)(current+1 - offset_1);
             const BYTE* const repBase = repIndex < dictLimit ? dictBase : base;
             const BYTE* const repMatch = repBase + repIndex;
+            if ((repIndex <= dictLimit-4) || (repIndex >= dictLimit))
             if (MEM_read32(ip+1) == MEM_read32(repMatch))            
             {
                 /* repcode detected we should take it */