From: Sean Purcell Date: Wed, 8 Mar 2017 00:52:23 +0000 (-0800) Subject: Reduce point at which we reduce offsets to protect against UB X-Git-Tag: v1.1.4~1^2~8^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F593%2Fhead;p=thirdparty%2Fzstd.git Reduce point at which we reduce offsets to protect against UB --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 308659467..15a9245e4 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -2347,7 +2347,7 @@ static size_t ZSTD_compress_generic (ZSTD_CCtx* cctx, if (remaining < blockSize) blockSize = remaining; /* preemptive overflow correction */ - if (cctx->lowLimit > (2U<<30)) { + if (cctx->lowLimit > (3U<<29)) { U32 const cycleMask = (1 << ZSTD_cycleLog(cctx->params.cParams.hashLog, cctx->params.cParams.strategy)) - 1; U32 const current = (U32)(ip - cctx->base); U32 const newCurrent = (current & cycleMask) + (1 << cctx->params.cParams.windowLog);