A bounds-checked cursor over WebAssembly binary bytes that records the first error with its offset
$ sexc add @ajax/wasm-reader- total 3
- drwxr-xr-x-../
- drwxr-xr-x-Oct 27 04:27v/# 1 version
- drwxr-xr-x-Oct 27 04:27files/# the files of 0.1.0
- latest
- 0.1.0, published Oct 27 04:27 by ajax
- owners
- ajax
- license
- MIT
- dependencies
- @ajax/wasm-leb128 ^0.1.0, @ajax/wasm-types ^0.1.0
- dependents
- @ajax/wasm-instr
- keywords
- wasm webassembly reader parser
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/wasm-reader 2 3A cursor over a WebAssembly binary: bounds-checked reads of bytes, LEB128 numbers, little-endian 4constants, names (with the spec's UTF-8 check) and vector counts (refused when they can't fit in what's 5left, so a hostile count never allocates). The first failure is recorded as `"<what> (at offset 0x<n>)"`, 6as wasmparser words it, and later reads return zeroes, so a parser reads straight through and checks 7`failed` at the end. Header-only. 8 9Part of alpha-c-mesh's WebAssembly interpreter (replacing wasmparser in the port of alpha-rust-mesh's 10`mesh-host/src/wasm.rs`). Tests: through `@ajax/wasm-decode` and `@ajax/wasm-instr`.