Skip to content

Fix catastrophic backtracking in C++ review regex - #729

Open
AustenMan wants to merge 1 commit into
peteromallet:mainfrom
AustenMan:fix/cxx-review-regex-backtracking
Open

Fix catastrophic backtracking in C++ review regex#729
AustenMan wants to merge 1 commit into
peteromallet:mainfrom
AustenMan:fix/cxx-review-regex-backtracking

Conversation

@AustenMan

Copy link
Copy Markdown

Summary

  • make the repeated C++ return-type prefix atomic so qualified-name non-matches cannot trigger catastrophic regex backtracking
  • add a regression test for the pathological qualified-name assignment shape

Reproduction

For a synthetic non-match shaped as repeated qualified names followed by an assignment, the prior regex grew from 0.04 s at 16 segments to 2.9 s at 22 segments. Five real C++ files in a 447-file project failed to finish within a two-second per-file probe.

Validation

  • python -m pytest desloppify/languages/cxx/tests/test_review.py -q: 3 passed
  • Ruff check and format check pass for both changed files
  • patched parser processed all 447 project C++ files in 1.203 s, with no file above 0.05 s
  • the previously stalled project review --prepare --dimensions design_coherence completed and generated its packet

The broader desloppify/tests run completed locally with 52 failures outside the modified C++ language module; the focused modified-module suite is clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant