Skip to content

fix(cpp): raise func_start's constructor initializer-list cap from 500 to 2000 chars - #2274

Merged
squid-protocol merged 3 commits into
mainfrom
fix/cpp-2009-init-list-cap
Aug 26, 2026
Merged

fix(cpp): raise func_start's constructor initializer-list cap from 500 to 2000 chars#2274
squid-protocol merged 3 commits into
mainfrom
fix/cpp-2009-init-list-cap

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Fixes #2009. func_start's member-initializer-list clause for constructors capped the span at 500 characters before requiring the body's opening brace. A real constructor with a long initializer list (many member fields) exceeds this cap, so the regex never reaches the brace and the WHOLE constructor is missed -- not degraded, entirely invisible.

Fix

Widened the cap from {0,500} to {0,2000} -- still a single bounded negated-character-class repetition, no unbounded quantifiers, consistent with the existing "IRON WALL" ReDoS-avoidance comment.

Evidence

  • language-crucible/data/cpp/mlir/flatbuffer_export.cc: the Translator class constructor (906-char initializer-list span) is now found.
  • ReDoS timing probe: sub-millisecond at 2000/4000/8000-char filler inputs, scaling ~1.2x rather than the ~4x that would signal O(n^2) backtracking.

Verification

  • pytest tests/extraction/languages/test_cpp.py tests/extraction/languages/test_cpp_strict.py -q -- 126 passed (1 new positive case, 1 new ReDoS timing probe added to the existing sweep)
  • audit_check.py --ci -- clean
  • crucible_check.py --mode both -- drift confined to cpp/mlir (Function Analysis change for flatbuffer_export.cc, attributable) plus expected global coordinate ripple, blessed
  • tree_sitter_accuracy_audit.py --lang cpp --ci -- clean, no naming-format issues

🤖 Generated with Gemini (via agy), orchestrated and independently verified by Claude Code.

squid-protocol and others added 2 commits August 26, 2026 11:10
…0 to 2000 chars

The cpp func_start regex's member-initializer-list clause for
constructors capped the span at 500 characters before requiring the
body's opening brace. A real constructor with a long initializer list
(many member fields) exceeds this cap, so the regex never reaches the
brace and the WHOLE constructor is missed -- not degraded, entirely
invisible.

Widened the cap to 2000 chars -- still a single bounded negated-
character-class repetition, no unbounded quantifiers, consistent with
the existing "IRON WALL" ReDoS-avoidance comment. Confirmed via timing
probe: sub-millisecond at 2000/4000/8000-char filler inputs, scaling
~1.2x rather than the ~4x that would signal O(n^2) backtracking.

Confirmed on language-crucible's mlir/flatbuffer_export.cc: the
Translator class constructor (906-char initializer-list span) is now
found.

Closes #2009

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…t-cap

# Conflicts:
#	tests/golden_master_audit.json
#	tests/golden_master_zero_dep_audit.json
@squid-protocol
squid-protocol enabled auto-merge (squash) August 26, 2026 15:14
…t-cap

# Conflicts:
#	gitgalaxy/standards/language_standards.py
#	tests/tree_sitter_accuracy_baseline_cpp.json
@squid-protocol
squid-protocol merged commit d0acbd6 into main Aug 26, 2026
@squid-protocol
squid-protocol deleted the fix/cpp-2009-init-list-cap branch August 26, 2026 15:19
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.

cpp func_start misses constructors with long member-initializer-lists

1 participant