skip to content
==> README.md <==
1# @ajax/wasm-decode
2
3Decodes a WebAssembly binary into a `wasm_module` (`@ajax/wasm-module`), checking everything the binary
4format requires: the header, section ids, order and exact sizes, custom sections' names, every vector
5and LEB, names' UTF-8, value types, limits flags (shared and 64-bit ones are recorded for the
6validator), element and data segment kinds, the function/code and data-count agreements, local counts
7(at most 50 000, as wasmparser), and well-formed constant expressions. Function bodies stay byte ranges
8for `@ajax/wasm-validate`. Counts are checked against the bytes left before anything is allocated, so a
9hostile binary never makes it allocate much or read out of bounds. Messages follow wasmparser's.
10
11Part of alpha-c-mesh's WebAssembly interpreter, which replaces wasmtime and wasmparser in the port of
12alpha-rust-mesh's `mesh-host/src/wasm.rs`.
13
14Tests: `tests/decode.c` (a module of every section kind, every truncation of it, and the malformed
15binaries the format forbids); fuzzing in `@ajax/wasm-interp`'s tests.