Skip to content

Safari (17.5 -> 18.0.1): "Out of bounds memory access" and "RangeError: Bad value" #4185

Answered by bes
bes asked this question in Q&A
Discussion options

You must be logged in to vote

This has been cooking for a long time, but I just managed to reproduce the bug locally and had time to do some digging. I still don't know 100% what is going on, but my latest investigation can be found here https://bugs.webkit.org/show_bug.cgi?id=286266 (Safari bug tracker)

Copied from the issue comment, which I wrote:

I was able to monkey patch the xx_wasm_bg.js file which is emitted from wasm-bindgen / wasmpack (Rust tools) to add a try / catch wrapper around the offending site.

function getStringFromWasm0(ptr, len) {
    try {
        ptr = ptr >>> 0;
        return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
    } catch (e) {
        console.error(e);
…

Replies: 6 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@daxpedda
Comment options

Comment options

You must be logged in to vote
1 reply
@bes
Comment options

Comment options

You must be logged in to vote
2 replies
@bes
Comment options

@bes
Comment options

Answer selected by bes
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants