mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:47:45 +00:00
LibJS: Fix start position of multi-line tokens
This broke in case of unterminated regular expressions, causing goofy location numbers, and 'source_location_hint' to eat up all memory: Unexpected token UnterminatedRegexLiteral. Expected statement (line: 2, column: 4294967292)
This commit is contained in:
parent
0d3a8d5397
commit
5d3c437cce
2 changed files with 23 additions and 15 deletions
|
@ -36,7 +36,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
|||
auto lexer = JS::Lexer(js);
|
||||
auto parser = JS::Parser(lexer);
|
||||
parser.parse_program();
|
||||
if (parser.has_errors())
|
||||
parser.print_errors();
|
||||
if (parser.has_errors()) {
|
||||
for (auto& error : parser.errors()) {
|
||||
if (error.line >= 100000 || error.column >= 100000) {
|
||||
fprintf(stderr, "%s\n", error.to_string().characters());
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue