From 881abe44f17d6fc8ef8805e221e4ae48f4a7d5f0 Mon Sep 17 00:00:00 2001 From: Sean Purcell Date: Tue, 7 Mar 2017 16:52:23 -0800 Subject: [PATCH] Reduce point at which we reduce offsets to protect against UB --- lib/compress/zstd_compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.2