Skip to content

runtime: implement WebAssembly/ESM integration for .wasm imports - #35587

Open
robobun wants to merge 9 commits into
mainfrom
farm/dd4bd17b/wasm-esm-integration
Open

runtime: implement WebAssembly/ESM integration for .wasm imports#35587
robobun wants to merge 9 commits into
mainfrom
farm/dd4bd17b/wasm-esm-integration

ci: retrigger

2fa51b5
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 25, 2026 in 39m 33s

Code review found 1 important issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/runtime/jsc_hooks.rs:3273-3275 Plugin virtual-module wasm bytes are Latin-1→UTF-8 transcoded, corrupting any byte ≥ 0x80

Annotations

Check failure on line 3275 in src/runtime/jsc_hooks.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Plugin virtual-module wasm bytes are Latin-1→UTF-8 transcoded, corrupting any byte ≥ 0x80

The `Bun.plugin` virtual-module wasm path added at ModuleLoader.cpp:417-421 receives corrupted bytes: `handleOnLoadResultNotPromise` builds an *untagged* `ZigString{view->vector(), byteLength()}` for ArrayBufferView `contents`, and `transpile_virtual_module` (jsc_hooks.rs:4625) calls `.to_slice()` on it — which Latin-1→UTF-8 transcodes every byte ≥ 0x80 (e.g. `0x80` → `0xC2 0x80`) before it reaches `args.virtual_source.contents` here. `check_magic` still passes (the `\0asm` header is all-ASCII),