Skip to content

Commit f0f2a45

Browse files
kddnewtonstevenjohnstone
authored andcommitted
[ruby/prism] Fix out-of-bounds read after utf-8 BOM
ruby/prism@198080c106 Co-authored-by: Steven Johnstone <[email protected]>
1 parent f2a6cb2 commit f0f2a45

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

prism/prism.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22865,8 +22865,8 @@ pm_parser_init(pm_parser_t *parser, const uint8_t *source, size_t size, const pm
2286522865
// If the shebang does not include "ruby" and this is the main script being
2286622866
// parsed, then we will start searching the file for a shebang that does
2286722867
// contain "ruby" as if -x were passed on the command line.
22868-
const uint8_t *newline = next_newline(parser->start, parser->end - parser->start);
22869-
size_t length = (size_t) ((newline != NULL ? newline : parser->end) - parser->start);
22868+
const uint8_t *newline = next_newline(parser->current.end, parser->end - parser->current.end);
22869+
size_t length = (size_t) ((newline != NULL ? newline : parser->end) - parser->current.end);
2287022870

2287122871
if (length > 2 && parser->current.end[0] == '#' && parser->current.end[1] == '!') {
2287222872
const char *engine;

0 commit comments

Comments
 (0)