diff options
author | Steven Johnstone <[email protected]> | 2023-06-23 15:43:28 +0100 |
---|---|---|
committer | git <[email protected]> | 2023-06-23 19:56:40 +0000 |
commit | 261e3663fdabd1665d0b978ecd12b0ddb639b190 (patch) | |
tree | 5a34deedf26d379a3bf4d98d1265d73a3ca696ad /yarp/regexp.c | |
parent | 6ee106ff7953c155fe9b04ae7d9fe4f4617d7348 (diff) |
[ruby/yarp] Check for eof in yp_regexp_char_is_eof
https://github.com/ruby/yarp/commit/f3fbc5bf9e
Diffstat (limited to 'yarp/regexp.c')
-rw-r--r-- | yarp/regexp.c | 5 |
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; } |