fix: reject quantifiers exceeding Perl's REG_INFTY limit#44
Draft
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
Draft
fix: reject quantifiers exceeding Perl's REG_INFTY limit#44toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_QUANTBIGerror 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
🤖 Generated with Claude Code