RESOLVED FIXED323441
JSArrayBuffer.prototype.resize performs an out-of-range size conversion
https://bugs.webkit.org/show_bug.cgi?id=323441
Summary JSArrayBuffer.prototype.resize performs an out-of-range size conversion
Marco Paciaroni
Reported 2026-09-04 09:38:28 PDT
## Summary `JSArrayBuffer.prototype.resize()` accepts a finite, non-negative JavaScript Number and converts it to `size_t` before checking that the value is representable. A value such as `1e20` reaches this conversion and triggers UBSan. ## PoC ``` new ArrayBuffer(1, { maxByteLength: 1 }).resize(1e20); print("RESIZE_UB_REDUCED_AFTER_CALL"); ``` ## Result Expected: an out-of-range requested size is rejected before conversion to `size_t`, with a defined JavaScript exception and no invalid native conversion. Actual: UBSan reports float-cast-overflow at `JSArrayBufferPrototype.cpp:299` for the out-of-range `resize` value. Release JSC returns a controlled `RangeError`; no Release or full WebKit crash was observed. ## Root cause The `resize` path performs only finite/non-negative checks before the `size_t` cast at line 299. A range check against the destination type is required before converting the author-controlled Number.
Attachments
Sergey Rubanov
Comment 1 2026-09-08 10:47:46 PDT
Radar WebKit Bug Importer
Comment 2 2026-09-11 09:39:14 PDT
Sergey Rubanov
Comment 3 2026-09-14 11:02:34 PDT
Note You need to log in before you can comment on or make changes to this bug.