1
0
mirror of https://github.com/facebook/zstd.git synced 2025-03-06 16:56:49 +02:00

conservatively estimate over-splitting in presence of incompressible loss

ensure data can never be expanded by more than 3 bytes per full block.
This commit is contained in:
Yann Collet 2024-10-22 15:25:45 -07:00
parent 5ae34e4c96
commit ea85dc7af6

View File

@ -4587,6 +4587,7 @@ static size_t ZSTD_compress_frameChunk(ZSTD_CCtx* cctx,
} /* if (ZSTD_useTargetCBlockSize(&cctx->appliedParams))*/
if (cSize < blockSize) savings += (blockSize - cSize);
else if (savings) savings--;
ip += blockSize;
assert(remaining >= blockSize);
remaining -= blockSize;