You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JS exception/crash in emsdk 6.0.2 when calling UTF8ToString #27241
I'm getting a 'crash' in 6.0.2 inside UTF8toString called from _emscripten_glShaderSource (this is a regression in 6.0.2 which didn't happen in 6.0.1):
Uncaught TypeError: Failed to execute 'decode' on 'TextDecoder': The provided ArrayBuffer value must not be resizable
at UTF8ArrayToString (v6502r.js:919:28)
at UTF8ToString (v6502r.js:964:20)
at Object.getSource (v6502r.js:2366:21)
at _emscripten_glShaderSource (v6502r.js:3607:23)
at v6502r.wasm._sg_gl_compile_shader (v6502r.wasm:0x6caca)
at v6502r.wasm._sg_gl_create_shader (v6502r.wasm:0x6c17c)
at v6502r.wasm._sg_create_shader (v6502r.wasm:0x3ff32)
at v6502r.wasm._sg_init_shader (v6502r.wasm:0x3e30a)
at v6502r.wasm.sg_make_shader (v6502r.wasm:0x4413a)
at v6502r.wasm.simgui_setup (v6502r.wasm:0x50794)
The code around the bottom of the callstack is:
varUTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{varendPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);// When using conditional TextDecoder, skip it for short strings as the overhead of the native call is not worth it.if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){// ========> CRASH HAPPENS HEREreturnUTF8Decoder.decode(heapOrArray.subarray(idx,endPtr));}varstr='';
...the crash happens on the first call to UTF8Decoder.decode(), there are plenty of earlier calls to UTF8ArrayToString(), but those all skip the if() condition (I guess this is why the problem didn't show up during testing, assuming the if-body isn't covered by tests).
...I guess this is related to this change in 6.0.2:
The GROWABLE_ARRAYBUFFERS setting now defaults to 1, which means it will be used when available. Note that this only affects programs that are built with ALLOW_MEMORY_GROWTH, which is not enabled by default. (#27212)
changed the title [-]Crash in emsdk 6.0.2 when calling UTF8ToString[/-][+]JS exception/crash in emsdk 6.0.2 when calling UTF8ToString[/+]on Jul 2, 2026
Activity
[-]Crash in emsdk 6.0.2 when calling UTF8ToString[/-][+]JS exception/crash in emsdk 6.0.2 when calling UTF8ToString[/+]emscripten.ts: pin default emsdk version to 6.0.1 for now (emscripten…
heyparth1 commentedon Jul 2, 2026
I'd like to work on this — opening a PR shortly.
floooh commentedon Jul 2, 2026
...oooof.... sorry for attacting the LLM bots...
sbc100 commentedon Jul 2, 2026
Can you confirm by setting
-sGROWABLE_ARRAYBUFFERS=0to see if that fixes it?husker-dev commentedon Jul 3, 2026
@sbc100
Encountered exactly the same problem.
-sGROWABLE_ARRAYBUFFERS=0fixed the issue for me.floooh commentedon Jul 3, 2026
@sbc100 yes, linking with
-sGROWABLE_ARRAYBUFFERS=0fixes the issue in emsdk 6.0.2sbc100 commentedon Jul 6, 2026
This will be fixed once we land #27242
Revert default for GROWABLE_ARRAYBUFFERS to 0
Revert default for GROWABLE_ARRAYBUFFERS to 0
Revert default for GROWABLE_ARRAYBUFFERS to 0
Revert default for GROWABLE_ARRAYBUFFERS to 0
Revert default for GROWABLE_ARRAYBUFFERS to 0 (#27260)
Emscripten kerfuffle (#53)
Fix crash in UTF8ToString with resizable ArrayBuffers (#27242)
Disable groable array buffers
Disable growable array buffers