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

LibJS: Disallow creating ArrayBuffers larger than 2^53 - 1

This is a normative change in the ECMA-262 spec. See:
25f9744
This commit is contained in:
Timothy Flynn 2023-05-25 11:22:01 -04:00 committed by Andreas Kling
parent d31b780760
commit 706a20c4d4
2 changed files with 25 additions and 4 deletions

View file

@ -11,3 +11,9 @@ test("ArrayBuffer constructor must be invoked with 'new'", () => {
ArrayBuffer();
}).toThrowWithMessage(TypeError, "ArrayBuffer constructor must be called with 'new'");
});
test("ArrayBuffer size limit", () => {
expect(() => {
new ArrayBuffer(2 ** 53);
}).toThrowWithMessage(RangeError, "Invalid array buffer length");
});