Skip to content

Commit 6e53478

Browse files
stevenjohnstoneEarlopain
authored andcommitted
Prevent an infinite loop parsing a capture name
Fixes #3729.
1 parent 27edbaf commit 6e53478

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/prism.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20395,6 +20395,9 @@ pm_named_capture_escape_unicode(pm_parser_t *parser, pm_buffer_t *unescaped, con
2039520395
}
2039620396

2039720397
size_t length = pm_strspn_hexadecimal_digit(cursor, end - cursor);
20398+
if (length == 0) {
20399+
break;
20400+
}
2039820401
uint32_t value = escape_unicode(parser, cursor, length);
2039920402

2040020403
(void) pm_buffer_append_unicode_codepoint(unescaped, value);

0 commit comments

Comments
 (0)