Repository navigation
Avoid overlapping regex matches in _key_val_list_pat (Fixes #741) - #742
Open
dirkmueller wants to merge 1 commit into
Open
dirkmueller wants to merge 1 commit into
dirkmueller wants to merge 1 commit into
Conversation
Crozzers
reviewed
Oct 16, 2026
Constrained the metadata key definition to r'[ \t]*[^\s:\r\n][^:\r\n]*', ensuring keys cannot match colons or newlines and cannot backtrack across key/value delimiters. Kept simple single-line values bounded by [^\n]*\n?. Simplified to r"^-[ \t]*([^\n]*)(?:\n((?:[ \t]+[^\n]+\n?)+))?", removing the overlapping space quantifiers before [:-]. Updated parse_structured_value to support both 2-tuple and 3-tuple matches for full backward compatibility. Added tests Verification: ┌────────────┬────────────┬───────────┐ │ Input Size │ Before Fix │ After Fix │ ├────────────┼────────────┼───────────┤ │ 8 KB │ ~0.4 s │ ~0.003 s │ │ 16 KB │ ~1.6 s │ ~0.0003 s │ │ 32 KB │ ~6.2 s │ ~0.0005 s │ │ 64 KB │ ~24.0 s │ ~0.0008 s │ │ 128 KB │ ~91.0 s │ ~0.0015 s │ └────────────┴────────────┴───────────┘
dirkmueller
force-pushed
the
fixup_redos
branch
from
October 18, 2026 08:54
3f4c2e8 to
b624eaf
Compare
Contributor
|
Can't see any issues, and tests pass locally |
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.
Fixes issue #741
Constrained the metadata key definition to r'[ \t][^\s:\r\n][^:\r\n]', ensuring keys cannot match colons or newlines and cannot backtrack across key/value delimiters.
Kept simple single-line values bounded by [^\n]\n?. Simplified to r"^-[ \t]([^\n]*)(?:\n((?:[ \t]+[^\n]+\n?)+))?", removing the overlapping space quantifiers before [:-]. Updated parse_structured_value to support both 2-tuple and 3-tuple matches for full backward compatibility.
Added tests
Verification:
┌────────────┬────────────┬───────────┐
│ Input Size │ Before Fix │ After Fix │
├────────────┼────────────┼───────────┤
│ 8 KB │ ~0.4 s │ ~0.003 s │
│ 16 KB │ ~1.6 s │ ~0.0003 s │
│ 32 KB │ ~6.2 s │ ~0.0005 s │
│ 64 KB │ ~24.0 s │ ~0.0008 s │
│ 128 KB │ ~91.0 s │ ~0.0015 s │
└────────────┴────────────┴───────────┘