]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Reduce point at which we reduce offsets to protect against UB 593/head
authorSean Purcell <me@seanp.xyz>
Wed, 8 Mar 2017 00:52:23 +0000 (16:52 -0800)
committerSean Purcell <me@seanp.xyz>
Wed, 8 Mar 2017 00:58:08 +0000 (16:58 -0800)
lib/compress/zstd_compress.c

index 3086594679813899d0dc31cf1c3e2dc8304e4dfc..15a9245e454fa86b6e8157539382c9e4eea36f9f 100644 (file)
@@ -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);