1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

js: Don't pass error strings as the format argument to outln()

This fixes a crash when the error contains '{}', or an invalid format
string.
This commit is contained in:
Ali Mohammad Pur 2022-07-16 10:15:51 +04:30 committed by Linus Groh
parent e43b478920
commit 4387ad9fc6

View file

@ -1187,7 +1187,7 @@ static bool parse_and_run(JS::Interpreter& interpreter, StringView source, Strin
auto hint = error.source_location_hint(source);
if (!hint.is_empty())
outln("{}", hint);
outln(error.to_string());
outln("{}", error.to_string());
result = interpreter.vm().throw_completion<JS::SyntaxError>(interpreter.global_object(), error.to_string());
} else {
auto return_early = run_script_or_module(script_or_error.value());