[ruby/yarp] fix: avoid invalid memory read when CR is present without LF

https://github.com/ruby/yarp/commit/2296c037de
This commit is contained in:
Mike Dalessio 2023-08-21 14:47:24 -04:00 committed by git
parent 461f8eaba7
commit 95e29b0423

View File

@ -6183,7 +6183,9 @@ parser_lex(yp_parser_t *parser) {
parser->current.end++;
}
yp_newline_list_check_append(&parser->newline_list, parser->current.end);
if (peek(parser) == '\n') {
yp_newline_list_append(&parser->newline_list, parser->current.end);
}
parser->current.end++;
if (parser->current.end < parser->end) {
@ -6191,7 +6193,7 @@ parser_lex(yp_parser_t *parser) {
}
}
switch (*parser->current.end) {
switch (peek(parser)) {
case 'i': {
parser->current.end++;