Skip to content

Commit 748dc9a

Browse files
kddnewtonstevenjohnstone
authored andcommitted
[ruby/prism] Fix out-of-bounds read in parser_lex_magic_comment
ruby/prism@e24e701f3a Co-authored-by: Steven Johnstone <[email protected]>
1 parent 7c2eb94 commit 748dc9a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

prism/prism.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8445,7 +8445,7 @@ parser_lex_magic_comment(pm_parser_t *parser, bool semantic_token_seen) {
84458445
if (*cursor == '\\' && (cursor + 1 < end)) cursor++;
84468446
}
84478447
value_end = cursor;
8448-
if (*cursor == '"') cursor++;
8448+
if (cursor < end && *cursor == '"') cursor++;
84498449
} else {
84508450
value_start = cursor;
84518451
while (cursor < end && *cursor != '"' && *cursor != ';' && !pm_char_is_whitespace(*cursor)) cursor++;

0 commit comments

Comments
 (0)