rea/tests/fixtures/wasm
Vinícius Andrade 1febc22907
fix(wasm): inspect modules whose custom section names contain NUL (#1981)
* fix(wasm): frame custom section names at their displayed NUL

wasm-objdump prints a custom section name with printf's %.*s, so an
embedded NUL ends the displayed name, as it does for module names.
The section row was compared with the complete name decoded from WAT,
so a valid module whose custom section name contains U+0000 failed
inspection with "WABT custom-section header does not match decoded
WAT". Compare the row with the displayed prefix instead.

* test(wasm): cover NUL-terminated custom section names

Frame the real objdump golden with a decoded custom section name that
continues after a NUL, and keep rejecting a displayed prefix that
differs from the decoded name.

* test(wasm): verify a NUL-containing custom section name with real WABT

Add a custom section named "visible\0hidden" to the real-tool custom
name fixture. WABT 1.0.42 decodes it as an escaped WAT name and
displays "visible" in wasm-objdump, so the verifier expects that
description through the compiled CLI and MCP.

* refactor(wasm): share WABT's NUL-terminated name display

Module-name preamble lines and custom-section rows each truncated the
decoded name at its first NUL. Keep that display rule in one helper so
both framings follow the same producer behavior. Output is unchanged.
2026-10-12 08:41:55 +08:00
..
README.md fix(wasm): inspect modules whose custom section names contain NUL (#1981) 2026-10-12 08:41:55 +08:00
artifact.ts feat(wasm): inspect local artifacts with WABT (#1533) 2026-10-11 19:49:00 +08:00
custom-names.wat fix(wasm): inspect modules whose custom section names contain NUL (#1981) 2026-10-12 08:41:55 +08:00
decoded.wat feat(wasm): inspect local artifacts with WABT (#1533) 2026-10-11 19:49:00 +08:00
module-names.wat fix(wasm): preserve debug module names in WABT output (#1967) 2026-10-12 05:44:15 +08:00
module.wat feat(wasm): inspect local artifacts with WABT (#1533) 2026-10-11 19:49:00 +08:00
objdump.txt feat(wasm): inspect local artifacts with WABT (#1533) 2026-10-11 19:49:00 +08:00

README.md

WABT producer fixtures

module.wat is source-owned. WABT 1.0.42 wat2wasm module.wat -o module.wasm produced the binary used for wasm-objdump -h -x module.wasm (objdump.txt) and wasm2wat --enable-all module.wasm (decoded.wat). No binary is checked in. The module has an imported function, exported memory/function and a test custom section. The custom payload is retained as an @custom annotation in decoded WAT.

Upstream tag commit: ff0ef7e0009402740c805a9744c09b05be063e48. The separate real-tool verifier generates its own fixtures with caller-supplied WABT and compares exact producer output against the public CLI/MCP surfaces. custom-names.wat covers newlines, quotes, Unicode, backslashes, embedded section markers and NUL in custom names; objdump displays those names without escaping and ends each at its first NUL.