Bug fix & run overflow correction much more frequently in tests#2603
Merged
terrelln merged 1 commit intofacebook:devfrom May 4, 2021
Merged
Bug fix & run overflow correction much more frequently in tests#2603terrelln merged 1 commit intofacebook:devfrom
terrelln merged 1 commit intofacebook:devfrom
Conversation
50f6931 to
34aff7e
Compare
Contributor
Author
|
Tests failed because it caught the |
* 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.
terrelln
added a commit
to terrelln/zstd
that referenced
this pull request
May 3, 2021
Switch from `-T0` to the default `-T1` which significantly reduces memory usage for level 19 when there are many cores. This fixes 32-bit issues of running out of address space. Fixes facebook#2603.
Cyan4973
reviewed
May 4, 2021
| * code much more frequently. This is very inefficient, and should only be | ||
| * used for tests and fuzzers. | ||
| */ | ||
| #ifndef ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY |
Contributor
There was a problem hiding this comment.
Should this macro be documented ?
I presume it's only meant to be used by maintainers.
Contributor
Author
There was a problem hiding this comment.
I don't think it really deserves documentation in any README.md, since it shouldn't be enabled in anything but tests. It is automatically enabled for fuzzers, which have a standard macro FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION.
If we wanted this to be used more widely, I think we would want to have a general debug flag like DEBUGLOG, except for enabling "expensive" checks.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
windowLog < cycleLog. Previously, wegot the correction wrong in this case, and our chain tables and binary
trees would be corrupted. Now, we work as long as
maxDistis a powerof two, by adding
MAX(maxDist, cycleSize)to our indices.ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLYis defined to non-zerorun overflow correction as frequently as allowed without impacting
compression ratio.
ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLYinfuzzerandzstreamtestas well as all the OSS-Fuzz fuzzers. This has a 5-10%speed penalty at most, which seems reasonable.
This change allows both the OSS-Fuzz fuzzers and
fuzzerandzstreamtestto all catch theZSTD_reduceIndex()bug, as well as the assertion failure.