Closed niieani closed 1 day ago
minimum reproduction:
function loop(bytes) {
const decoder = new TextDecoder("utf-8", { fatal: true });
try {
decoder.decode(bytes);
} catch {}
}
for (let i = 0; i < 256; i++) {
loop(Uint8Array.from([i]));
}
To fix this, we will likely need to disable DOMJIT
How can we reproduce the crash?
https://codesandbox.io/p/devbox/bun-segfault-repro-ywl98g?file=/http.ts:35,7
The segfault isn't the only problem. Some additional weirdness that's going on is the try/catch doesn't seem to be catching the error. If you remove
console.log('Decoded:', bytes, v)
, you'll get that exact circumstance.Relevant log output
Stack Trace (bun.report)
Bun v1.1.27 (
267afa2
) on macos aarch64 [AutoCommand]Segmentation fault at address 0x00000005
llint_entry
llint_entry
llint_entry
llint_entry
vmEntryToJavaScript
JSC::Interpreter::executeCall
JSC::runJSMicrotask