we (web engine): Experimental web browser project to understand the limits of Claude
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

WebAssembly module validator #221

open opened by pierrelf.com

Validate parsed WebAssembly modules per the spec's validation algorithm (WebAssembly Core Specification 2.0, ยง3 Validation). Validation must complete before any module is allowed to execute. Depends on the binary module parser issue.

Scope:

  • Implement the full type-checking algorithm for instruction sequences using the spec's stack-polymorphic notation (operand stack, control stack, polymorphic Unreachable type).
  • Validate every section's contents: type signatures, function-to-type indexing, table/memory/global limits, import/export consistency, element/data segments referencing valid types/indices, start function signature () -> ().
  • Validate every instruction's stack effect against the static type of the function, including block/loop/if structured control flow, br/br_if/br_table label arity, call/call_indirect type compatibility, table.get/table.set/table.size/table.grow type checks, and global.get/global.set mutability rules.
  • Enforce the byte-length and count limits required by the spec (e.g., max locals per function, max function index space).
  • Produce ValidationError values that point at the offending function index and instruction offset.

Acceptance criteria:

  • Validates every binary fixture from the parser test suite; rejects hand-crafted invalid modules (stack underflow, mistyped branch, mutating immutable global, etc.) with the right error variant.
  • Unit tests cover stack-polymorphism around unreachable, multi-value blocks, br_table arity matching, and call_indirect type mismatches.
  • Public API: we-wasm::validate(&Module) -> Result<(), ValidationError>.
  • cargo clippy --workspace -- -D warnings passes; 100% safe Rust; zero external dependencies.
sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:meotu43t6usg4qdwzenk4s2t/sh.tangled.repo.issue/3mm2tjwo7k222