Skip to content

Conversation

@stevenjohnstone
Copy link
Contributor

Fixes #3729.

@Earlopain
Copy link
Collaborator

Earlopain commented Nov 19, 2025

Thanks, can you add a test for this? In test/prism/fixtures create regex_capture.txt or similar that contains /(?<\u{21!3}>foo)/ =~ "foo" and /(?<\u{21!3}>foo)/. When you run tests with UPDATE_SNAPSHOTS=1 bundle exec rake, a snapshot file gets created that you should commit.

(I guess some other parsers we test against may correctly reject this code. If that is the case, simply excluding this new file for them is fine)

Copy link
Collaborator

@Earlopain Earlopain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. Since this seems to be correctly implemented everywhere but prism, I just dropped the test. I now feel that wasn't such a bright idea after all.

@Earlopain Earlopain merged commit cf8316d into ruby:main Dec 13, 2025
64 checks 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.

Infinite loop/memory exhaustion parsing a rexexp named capture with a malformed unicode escape

2 participants