From: Yann Collet Date: Sun, 22 Nov 2015 02:01:33 +0000 (+0100) Subject: fixed roll buffer greedy mode X-Git-Tag: zstd-0.4.0^2~23^2~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=734aa92ed5404a0de76af0ea8c9393800b14b01b;p=thirdparty%2Fzstd.git fixed roll buffer greedy mode --- diff --git a/lib/zstd_compress.c b/lib/zstd_compress.c index e1a81dae1..a599712bc 100644 --- a/lib/zstd_compress.c +++ b/lib/zstd_compress.c @@ -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 */