1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-01 09:47:01 +03:00

context can be sized down even with constant parameters

when parameters are "equivalent",
the context is re-used in continue mode,
hence needed workspace size is not recalculated.
This incidentally also evades the size-down check and action.

This patch intercepts the "continue mode"
so that the size-down check and action is actually triggered.
This commit is contained in:
Yann Collet
2018-06-06 15:04:12 -07:00
parent e5e17d009f
commit f1ea383f45
2 changed files with 8 additions and 8 deletions

View File

@ -490,8 +490,7 @@ static int basicUnitTests(U32 seed, double compressibility)
* make this test long enough so that it's not too much tied to the current definition within zstd_compress.c */
U32 u;
for (u=0; u<maxNbAttempts; u++) {
size_t const srcSize = (FUZ_rand(&seed) & 4095) + 200;
CHECK_Z(ZSTD_compressCCtx(largeCCtx, compressedBuffer, compressedBufferSize, CNBuffer, srcSize, -9));
CHECK_Z(ZSTD_compressCCtx(largeCCtx, compressedBuffer, compressedBufferSize, CNBuffer, 1, 1));
if (ZSTD_sizeof_CCtx(largeCCtx) < largeCCtxSize) break; /* sized down */
}
DISPLAYLEVEL(5, "size down after %u attempts : ", u);