[ruby/prism] Prevent an infinite loop parsing a capture name

Fixes https://github.com/ruby/prism/pull/3729.

https://github.com/ruby/prism/commit/6e5347803c
This commit is contained in:
Steven Johnstone 2025-11-19 09:30:57 +00:00 committed by git
parent 8f2c479fa5
commit 0561eb9425

View File

@ -20395,6 +20395,9 @@ pm_named_capture_escape_unicode(pm_parser_t *parser, pm_buffer_t *unescaped, con
}
size_t length = pm_strspn_hexadecimal_digit(cursor, end - cursor);
if (length == 0) {
break;
}
uint32_t value = escape_unicode(parser, cursor, length);
(void) pm_buffer_append_unicode_codepoint(unescaped, value);