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:
parent
dc83f3375c
commit
f3a937ee76
Notes:
github-actions[bot]
2025-03-25 07:46:40 +00:00
Author: https://github.com/ttrssreal
Commit: f3a937ee76
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4022
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/gmta ✅
2 changed files with 26 additions and 2 deletions
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue