1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +00:00

LibJS: Guard against stack overflow in ProxyObject set_property()

For similar reason as in the previous commit.
This commit is contained in:
Maciej 2023-05-04 14:33:20 +02:00 committed by Tim Flynn
parent 52a5a42147
commit 5d2e915623
2 changed files with 34 additions and 1 deletions

View file

@ -112,3 +112,20 @@ describe("[[Set]] 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"] = "bar";
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
});
test("Proxy that has the Proxy itself as its prototype", () => {
const proxy = new Proxy({}, {});
proxy.__proto__ = Object.create(proxy);
expect(() => {
proxy["foo"] = "bar";
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
});