Conversation
Contributor
|
Just to verify, this fixes both offset_1 bugs, right? |
Contributor
Author
|
Right |
terrelln
approved these changes
May 19, 2020
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.
Issue 22294, firing
assert(offset_1 <= current +1)withincompress_fast_extDict(),and issue 22262, firing
assert(offset_1 <= dictAndPrefixLength)withincompress_fast_dictMatchState(),are actually a consequence of a new behavior enabled within
ldm, that has become possible since the new--patch-fromcapability (and therefore not present in earlier versions) :ldmwould not load any dictionary when in multithreading mode--patch-fromcapabilityldmis necessary in order to catch long-distance correlations--patch-fromldmingest the full dictionary as a content, irrespective of being a "raw" dictionary (only content) or a "full" dictionary (header and entropy tables)ldmloads entropy tables as "content", and may be able to find matches into them (just as a matter of random luck)ldmhas found such a match, it passes the following literals section to the regular match finder (compress_fast()in this case), where the previous offset is passed as repeat codeassert(). Without theassert(), the resulting pointer is invalid, and result in a segfault.This PR makes the minimum to control the damage :
Now
ldmonly loads the dictionary if it is labelled a "raw" dictionary, as it is the only case which matters for--patch-from. If the dictionary is labelled "auto" or "full", it is not loaded at all.This was the behavior of
ldmbefore the--patch-frommode.It also avoids expanding the scope and creating new scenarios, that would have to be fuzzed.
This PR doesn't have a test case attached.
It's a bit tricky to generate, as it requires a "full" dictionary, with a matching pattern directly in the encoded entropy section of the header (which looks like random bytes), so it's unclear how to generate this case intentionally.
But we can add the known cases as "golden files" to our regression corpus.