Skip to content

Support for memory64 / table64 (wasm64) binaries #130285

Description

@lewing

Summary

The nesm wasm parser fails when loading WebAssembly binaries that use the memory64 and table64 proposals (i.e., wasm64 binaries). The error is:

Invalid module: Unsigned LEB128 value overflows uint32

This occurs because memory64/table64 use 64-bit LEB128 values for memory limits and table sizes, but the parser currently uses uint32 for LEB128 decoding in those sections.

Reproduction

Load any wasm binary compiled with Emscripten's -sMEMORY64=1 flag. For example, .NET's CoreCLR interpreter compiled for browser-wasm64:

Memory[1]:
 - memory[0] pages: initial=2048 max=131072 i64
Table[1]:
 - table[0] type=funcref initial=3775 i64

Both wasm_load_file and wasm_inspect fail with the LEB128 overflow error. Native wasm-objdump (from WABT) parses the same binary correctly.

Affected tools

All tools that parse the binary are affected: wasm_load_file, wasm_inspect, wasm_load_binary, wasm_run, etc.

Context

The memory64 proposal is now at Phase 4 and shipping in V8 (Chrome/Node.js). It's used by .NET's CoreCLR wasm64 port to support >4GB linear memory for managed applications. Support in nesm would enable using the MCP tools for debugging and inspecting wasm64 binaries.

Note

This issue was generated with the help of Copilot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Build-monoenhancementProduct code improvement that does NOT require public API changes/additionsuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions