runtime: implement WebAssembly/ESM integration for .wasm imports - #35587
Open
robobun wants to merge 9 commits into
Open
runtime: implement WebAssembly/ESM integration for .wasm imports#35587robobun wants to merge 9 commits into
robobun wants to merge 9 commits into
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
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),
Loading