Skip to content

Commit e24e701

Browse files
Fix out-of-bounds read in parser_lex_magic_comment
Co-authored-by: Steven Johnstone <steven.james.johnstone@gmail.com>
1 parent c2dfb8e commit e24e701

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/prism.c

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

0 commit comments

Comments
 (0)