From: Yann Collet Date: Tue, 17 Nov 2015 15:14:55 +0000 (+0100) Subject: fix compression bug in rollbuffer mode X-Git-Tag: zstd-0.4.0^2~23^2~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94b9d8ec8db8d4ca937ea55502e89a579c33c8cd;p=thirdparty%2Fzstd.git fix compression bug in rollbuffer mode --- diff --git a/lib/zstd_compress.c b/lib/zstd_compress.c index ad3db50c5..53dfc742f 100644 --- a/lib/zstd_compress.c +++ b/lib/zstd_compress.c @@ -867,7 +867,7 @@ size_t ZSTD_compressBlock_fast_extDict_generic(ZSTD_CCtx* ctx, const BYTE* iEndCount = (matchEnd - match < iend - ip) ? ip + (matchEnd - match) : iend; size_t matchLength = ZSTD_count(ip+MINMATCH, match+MINMATCH, iEndCount); size_t offsetCode = current-matchIndex; - if (matchIndex + matchLength + MINMATCH == dictLimit) + if (match + matchLength + MINMATCH == matchEnd) matchLength += ZSTD_count(ip + matchLength + MINMATCH, base + dictLimit, iend); if (offsetCode == offset_2) offsetCode = 0; offset_2 = offset_1;