Skip to content

Commit 6ee106f

Browse files
stevenjohnstonematzbot
authored andcommitted
[ruby/yarp] If ? is last char of regexp buffer, don't read beyond it.
ruby/prism@1764532572
1 parent 6dc2314 commit 6ee106f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

yarp/regexp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ static bool
338338
yp_regexp_parse_group(yp_regexp_parser_t *parser) {
339339
// First, parse any options for the group.
340340
if (yp_regexp_char_accept(parser, '?')) {
341+
if (yp_regexp_char_is_eof(parser)) {
342+
return false;
343+
}
341344
yp_regexp_options_t options;
342345
yp_regexp_options_init(&options);
343346

0 commit comments

Comments
 (0)