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-from
capability (and therefore not present in earlier versions) :ldm
would not load any dictionary when in multithreading mode--patch-from
capabilityldm
is necessary in order to catch long-distance correlations--patch-from
ldm
ingest the full dictionary as a content, irrespective of being a "raw" dictionary (only content) or a "full" dictionary (header and entropy tables)ldm
loads entropy tables as "content", and may be able to find matches into them (just as a matter of random luck)ldm
has 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
ldm
only 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
ldm
before the--patch-from
mode.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.