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

LibJS: Prevent stack overflow if Proxy handler's __proto__ is the Proxy

Fixes #9322.
This commit is contained in:
Linus Groh 2021-09-05 20:21:58 +01:00
parent 9998a2c91e
commit 941ff0cf60
2 changed files with 27 additions and 0 deletions

View file

@ -107,3 +107,12 @@ describe("[[Get]] invariants", () => {
);
});
});
test("Proxy handler that has the Proxy itself as its prototype", () => {
const handler = {};
const proxy = new Proxy({}, handler);
handler.__proto__ = proxy;
expect(() => {
proxy.foo;
}).toThrowWithMessage(Error, "Call stack size limit exceeded");
});