Merge pull request #593 from iburinoc/undef

Reduce point at which we reduce offsets to protect against UB
This commit is contained in:
Yann Collet 2017-03-07 18:31:38 -08:00 committed by GitHub
commit 15c9dd80a8

View 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);