mirror of
https://github.com/facebook/zstd.git
synced 2025-07-29 11:21:22 +03:00
Bug fix & run overflow correction much more frequently in tests
* Fix overflow correction when `windowLog < cycleLog`. Previously, we got the correction wrong in this case, and our chain tables and binary trees would be corrupted. Now, we work as long as `maxDist` is a power of two, by adding `MAX(maxDist, cycleSize)` to our indices. * When `ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY` is defined to non-zero run overflow correction as frequently as allowed without impacting compression ratio. * Enable `ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY` in `fuzzer` and `zstreamtest` as well as all the OSS-Fuzz fuzzers. This has a 5-10% speed penalty at most, which seems reasonable.
This commit is contained in:
@ -672,7 +672,7 @@ static int basicUnitTests(U32 seed, double compressibility)
|
||||
cSize = ZSTD_compress(compressedBuffer, compressedBufferSize, CNBuffer, CNBufferSize, 1);
|
||||
CHECK_Z(cSize);
|
||||
{ ZSTD_DCtx* dctx = ZSTD_createDCtx();
|
||||
size_t const dctxSize0 = ZSTD_sizeof_DCtx(dctx);
|
||||
size_t const dctxSize0 = ZSTD_sizeof_DCtx(dctx);
|
||||
size_t dctxSize1;
|
||||
CHECK_Z(ZSTD_DCtx_setParameter(dctx, ZSTD_d_stableOutBuffer, 1));
|
||||
|
||||
@ -735,7 +735,7 @@ static int basicUnitTests(U32 seed, double compressibility)
|
||||
CHECK(ZSTD_getErrorCode(r) != ZSTD_error_dstBuffer_wrong, "Must error but got %s", ZSTD_getErrorName(r));
|
||||
}
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : ZSTD_decompressStream() buffered output : ", testNb++);
|
||||
ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only);
|
||||
CHECK_Z(ZSTD_DCtx_setParameter(dctx, ZSTD_d_stableOutBuffer, 0));
|
||||
|
Reference in New Issue
Block a user