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

LibJS: Don't hang when parsing invalid destructuring assignment target

Previously, certain crafted input could cause the JS parser to hang, as
it repeatedly tried to parse an EOF token after hitting an "invalid
destructuring assignment target" error. This change ensures that we
stop parsing after hitting this error condition.
This commit is contained in:
Tim Ledbetter 2023-11-12 20:30:32 +00:00 committed by Andreas Kling
parent 01d938c77b
commit b5875700e2
2 changed files with 20 additions and 7 deletions

View file

@ -0,0 +1,5 @@
test("Assigning to an invalid destructuring assignment target should fail immediately", () => {
expect(() => {
eval("[[function=a{1,}=");
}).toThrow(SyntaxError);
});