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-23 11:50:57 -07:00
parent 5ae34e4c96
commit ea85dc7af6
+1
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;