aboutsummaryrefslogtreecommitdiffstats
path: root/yarp
diff options
context:
space:
mode:
authorSteven Johnstone <steven.james.johnstone@gmail.com>2023-06-23 15:43:28 +0100
committergit <svn-admin@ruby-lang.org>2023-06-23 19:56:40 +0000
commit261e3663fdabd1665d0b978ecd12b0ddb639b190 (patch)
tree5a34deedf26d379a3bf4d98d1265d73a3ca696ad /yarp
parent6ee106ff7953c155fe9b04ae7d9fe4f4617d7348 (diff)
downloadruby-261e3663fdabd1665d0b978ecd12b0ddb639b190.tar.gz
[ruby/yarp] Check for eof in yp_regexp_char_is_eof
https://github.com/ruby/yarp/commit/f3fbc5bf9e
Diffstat (limited to 'yarp')
-rw-r--r--yarp/regexp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/yarp/regexp.c b/yarp/regexp.c
index 89eda53142..339438c783 100644
--- a/yarp/regexp.c
+++ b/yarp/regexp.c
@@ -57,6 +57,9 @@ yp_regexp_char_expect(yp_regexp_parser_t *parser, char value) {
// This advances the current token to the next instance of the given character.
static bool
yp_regexp_char_find(yp_regexp_parser_t *parser, char value) {
+ if (yp_regexp_char_is_eof(parser)) {
+ return false;
+ }
const char *end = (const char *) memchr(parser->cursor, value, (size_t) (parser->end - parser->cursor));
if (end == NULL) {
return false;
@@ -383,7 +386,7 @@ yp_regexp_parse_group(yp_regexp_parser_t *parser) {
break;
case '\'': { // named capture group
const char *start = ++parser->cursor;
- if (yp_regexp_char_is_eof(parser) || !yp_regexp_char_find(parser, '\'')) {
+ if (!yp_regexp_char_find(parser, '\'')) {
return false;
}