1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibJS: Fix integer overflow in target_offset of TypedArray.set()

This commit is contained in:
Jess 2025-03-21 07:04:26 +13:00 committed by Jelle Raaijmakers
parent dc83f3375c
commit f3a937ee76
Notes: github-actions[bot] 2025-03-25 07:46:40 +00:00
2 changed files with 26 additions and 2 deletions

View file

@ -146,3 +146,19 @@ test("detached buffer", () => {
expect(typedArray.length).toBe(0);
});
});
test("very large targetOffset", () => {
TYPED_ARRAYS.forEach(({ array: T }) => {
let typedArray = new T();
expect(() => {
// set_typed_array_from_typed_array
typedArray.set(typedArray, 2 ** 128);
}).toThrowWithMessage(RangeError, "Overflow or out of bounds in target offset");
expect(() => {
// set_typed_array_from_array_like
typedArray.set([], 2 ** 128);
}).toThrowWithMessage(RangeError, "Overflow or out of bounds in target offset");
});
});