mirror of
https://github.com/facebook/zstd.git
synced 2025-10-10 00:03:36 -04:00
Merge pull request #593 from iburinoc/undef
Reduce point at which we reduce offsets to protect against UB
This commit is contained in:
commit
15c9dd80a8
@ -2347,7 +2347,7 @@ static size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
|
|||||||
if (remaining < blockSize) blockSize = remaining;
|
if (remaining < blockSize) blockSize = remaining;
|
||||||
|
|
||||||
/* preemptive overflow correction */
|
/* 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 cycleMask = (1 << ZSTD_cycleLog(cctx->params.cParams.hashLog, cctx->params.cParams.strategy)) - 1;
|
||||||
U32 const current = (U32)(ip - cctx->base);
|
U32 const current = (U32)(ip - cctx->base);
|
||||||
U32 const newCurrent = (current & cycleMask) + (1 << cctx->params.cParams.windowLog);
|
U32 const newCurrent = (current & cycleMask) + (1 << cctx->params.cParams.windowLog);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user