fixed : compression bug on very large files
This commit is contained in:
parent
2c9e90e711
commit
96bdd87de4
@ -2274,7 +2274,7 @@ static size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
|
|||||||
if (cctx->lowLimit > (1<<30)) {
|
if (cctx->lowLimit > (1<<30)) {
|
||||||
U32 const btplus = (cctx->params.cParams.strategy == ZSTD_btlazy2) | (cctx->params.cParams.strategy == ZSTD_btopt);
|
U32 const btplus = (cctx->params.cParams.strategy == ZSTD_btlazy2) | (cctx->params.cParams.strategy == ZSTD_btopt);
|
||||||
U32 const chainMask = (1 << (cctx->params.cParams.chainLog - btplus)) - 1;
|
U32 const chainMask = (1 << (cctx->params.cParams.chainLog - btplus)) - 1;
|
||||||
U32 const newLowLimit = cctx->lowLimit & chainMask; /* preserve position % chainSize */
|
U32 const newLowLimit = (cctx->lowLimit & chainMask) + (chainMask+1); /* preserve position % chainSize, ensure current-repcode doesn't underflow */
|
||||||
U32 const correction = cctx->lowLimit - newLowLimit;
|
U32 const correction = cctx->lowLimit - newLowLimit;
|
||||||
ZSTD_reduceIndex(cctx, correction);
|
ZSTD_reduceIndex(cctx, correction);
|
||||||
cctx->base += correction;
|
cctx->base += correction;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user