From: inikep Date: Fri, 29 Jul 2016 14:45:39 +0000 (+0200) Subject: zstd_opt.h: fixed checking of rep codes (2) X-Git-Tag: v0.8.0^2~18^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F264%2Fhead;p=thirdparty%2Fzstd.git zstd_opt.h: fixed checking of rep codes (2) --- diff --git a/lib/compress/zstd_opt.h b/lib/compress/zstd_opt.h index 387d62400..9496ed358 100644 --- a/lib/compress/zstd_opt.h +++ b/lib/compress/zstd_opt.h @@ -885,7 +885,7 @@ void ZSTD_compressBlock_opt_extDict_generic(ZSTD_CCtx* ctx, const U32 repIndex = (U32)(current+cur - opt[cur].rep[i]); const BYTE* const repBase = repIndex < dictLimit ? dictBase : base; const BYTE* const repMatch = repBase + repIndex; - if ((rep[i]<(U32)(ip-prefixStart)) + if ((opt[cur].rep[i]<(U32)(ip-prefixStart)) && (((U32)((dictLimit-1) - repIndex) >= 3) & (repIndex>lowestIndex)) /* intentional overflow */ && (MEM_readMINMATCH(inr, minMatch) == MEM_readMINMATCH(repMatch, minMatch)) ) { /* repcode detected */