Repository navigation
grep: reject non-POSIX and unclosed [:name:] classes in BRE/ERE - #253
yunusarda-sudo wants to merge 2 commits into
Conversation
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #253 +/- ##
==========================================
+ Coverage 97.22% 97.23% +0.01%
==========================================
Files 6 6
Lines 2270 2279 +9
Branches 245 246 +1
==========================================
+ Hits 2207 2216 +9
Misses 63 63
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
GNU grep testsuite comparison: |
|
GNU grep testsuite comparison: |
GNU grep accepts only the twelve POSIX class names inside a bracket expression (
alnum,alpha,blank,cntrl,digit,graph,lower,print,punct,space,upper,xdigit). Any other name, such as[[:word:]],[[:ascii:]], the negated[[:^alpha:]]or the empty[[::]], fails withInvalid character class nameand exit code 2. An unclosed[:,[., or[=inside a bracket expression (like[[:alpha]]or[x[:]y]) fails withUnmatched [, [^, [:, [., or [=.Previously,
scan_bracketonly checked for misspelled[:space:]syntax without validating the class name or reporting unclosed subexpressions, allowing non-POSIX classes to pass through to Oniguruma.This patch:
[:...:]and errors withInvalid character class nameon non-POSIX/negated names.Unmatched [, [^, [:, [., or [=when[:,[., or[=is not properly closed before the end of the bracket.[:space:]diagnostic.Fixes #171
Investigated and verified locally with
cargo fmt --all -- --check,cargo clippy -- -D warnings, andcargo test.