Skip to content

Commit 198080c

Browse files
Fix out-of-bounds read after utf-8 BOM
Co-authored-by: Steven Johnstone <steven.james.johnstone@gmail.com>
1 parent c2dfb8e commit 198080c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/prism.c

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

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

0 commit comments

Comments
 (0)