From 6ee106ff7953c155fe9b04ae7d9fe4f4617d7348 Mon Sep 17 00:00:00 2001 From: Steven Johnstone Date: Fri, 23 Jun 2023 10:53:38 +0100 Subject: [PATCH] [ruby/yarp] If ? is last char of regexp buffer, don't read beyond it. https://github.com/ruby/yarp/commit/1764532572 --- yarp/regexp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yarp/regexp.c b/yarp/regexp.c index cf9dba95c52052..89eda53142efdf 100644 --- a/yarp/regexp.c +++ b/yarp/regexp.c @@ -338,6 +338,9 @@ static bool yp_regexp_parse_group(yp_regexp_parser_t *parser) { // First, parse any options for the group. if (yp_regexp_char_accept(parser, '?')) { + if (yp_regexp_char_is_eof(parser)) { + return false; + } yp_regexp_options_t options; yp_regexp_options_init(&options);