Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

<regex>: Limit recursion in the parser#5588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@muellerj2
Copy link
Contributor

#4451 limited recursion for capture groups in the parser. However, unlimited recursion in the parser is still possible for regexes that use non-capturing groups or lookahead assertions. This PR similarly limits the recursion for such constructs by using the parser's pre-existing internal recursion counter,_Disj_count.

This supersedes the capture group limit introduced by#4451 as a way to prevent stack overflows. But I'm leaving it in because regexes using more than 1000 capture groups strike me as bogus anyway. (I think the error codeerror_space would be more appropriate in this case now, since the limit is no longer about preventing recursion, but it's probably not worth introducing a minor behavior difference just for this reason. One could even argue thaterror_space is more appropriate for the new stack limit introduced by this PR, too, becauseerror_space is about regex construction, whileerror_stack is about regex matching.)

I also fix a mistake in_Matcher2::_Skip()'s recursion limitation: In#5576, I accidentally missed to pass the recursion counter as an argument to one of the recursive calls.

frederick-vs-ja reacted with heart emoji
@StephanTLavavejStephanTLavavej added enhancementSomething can be improved regexmeow is a substring of homeowner labelsJun 14, 2025
@StephanTLavavejStephanTLavavej removed their assignmentJun 14, 2025
@StephanTLavavejStephanTLavavej moved this fromInitial Review toReady To Merge inSTL Code ReviewsJun 14, 2025
@StephanTLavavejStephanTLavavej moved this fromReady To Merge toMerging inSTL Code ReviewsJul 14, 2025
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavejStephanTLavavej merged commita1f193d intomicrosoft:mainJul 15, 2025
39 checks passed
@github-project-automationgithub-project-automationbot moved this fromMerging toDone inSTL Code ReviewsJul 15, 2025
@StephanTLavavej
Copy link
Member

Thanks for closing this potential avenue to stack overflows! 🛑 ❌ ⛔

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

Reviewers

@StephanTLavavejStephanTLavavejStephanTLavavej approved these changes

Assignees

No one assigned

Labels

enhancementSomething can be improvedregexmeow is a substring of homeowner

Projects

Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@muellerj2@StephanTLavavej

[8]ページ先頭

©2009-2025 Movatter.jp