Skip to content

fix: bound C++ extractor regex backtracking - #733

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

fix: bound C++ extractor regex backtracking#733
AustenMan wants to merge 1 commit into
peteromallet:mainfrom
AustenMan:fix/cxx-extractor-regex-backtracking

Conversation

@AustenMan

Copy link
Copy Markdown

Problem

C++ signature extraction can spend hours in catastrophic regex backtracking on qualified-name declarations. In a 501-file C++ scan, generated/include/viewer/automation/api_types.hpp was the first reproducible stall; a 21-segment synthetic declaration took 3.854 seconds by itself.

Fix

Make the repeated C++ return-type prefix atomic so failed function-declaration matches cannot repartition the same qualified tokens exponentially. Add an adversarial regression test with a generous timing bound.

Evidence

  • Synthetic adversarial declaration: 3.854 s to 0.000019 s
  • Previously stalling api_types.hpp: 0.055901 s
  • All 501 C++ files: 5.261096 s, 2,263 functions
  • C++ plugin and generic signature detector tests: 64 passed
  • Focused extractor tests: 6 passed

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