Skip to content

fix: reject quantifiers exceeding Perl's REG_INFTY limit#44

Draft
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
toddr-bot:koan.toddr.bot/fix-quantifier-overflow
Draft

fix: reject quantifiers exceeding Perl's REG_INFTY limit#44
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
toddr-bot:koan.toddr.bot/fix-quantifier-overflow

Conversation

@toddr-bot
Copy link
Copy Markdown
Collaborator

What

Reject {n,m} quantifiers where n or m exceed 2147483646 (Perl's REG_INFTY).

Why

Perl itself rejects these with "Quantifier in {,} bigger than 2147483646". The parser was silently accepting them, producing nodes with values that have no valid Perl semantics. This matters for tools that use the parser to validate regex patterns before compilation.

How

New RPe_QUANTBIG error code in Diagnostics.pm. The { handler in Handlers.pm validates both min and max values against REG_INFTY before the existing n > m check. The error message format matches Perl's native error.

Testing

  • 6 rejection tests (just above, at, and far above the limit, for both n and m positions)
  • 3 acceptance tests (values exactly at the limit remain valid)
  • Full test suite passes: 1167 tests across 20 files

🤖 Generated with Claude Code

Perl rejects {n,m} quantifiers where n or m exceed 2147483646
(0x7FFFFFFE, the internal REG_INFTY constant). The parser was
silently accepting these, producing nodes with arbitrarily large
values that don't correspond to valid Perl regex behavior.

Add RPe_QUANTBIG error code and validate both min and max values
in the { handler before checking n > m ordering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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