The module's memory is a contiguous typed-array region of page-aligned bytes (64KiB/page, the real WebAssembly page size). Every store instruction is bounds-checked before it touches memory:
boundsCheck(addr, len, bound):
return addr >= 0 AND addr + len <= bound
// bound = currentPages * 65536
// a failing check traps the whole call — memory is
// never partially written past the edge, unlike a
// native buffer overrun that keeps writing into
// whatever byte comes next in the process's address space
Every import call is checked against a capability table the host controls, not the module:
callImport(name):
if not host.capabilities[name].granted:
trap("unlinkable import" / RuntimeError)
return hostFunction[name](...)
// console.log, math.sqrt -> granted at instantiation, fixed
// fs.open, net.connect -> toggled live below
// process.spawn -> never in any import object;
// WASM has no raw syscall opcode,
// so there is nothing to revoke —
// it was never reachable to begin with
- Memory overflow attempt — issues a store whose
addr+len lands past the current page bound. The engine traps it at the exact byte boundary; the equivalent native strcpy-style overrun would instead corrupt whatever heap/stack memory sits next.
- Unauthorized syscall attempt — calls
process.spawn, which is never present in the host's import object. The call is rejected before it can execute, because capability grants are additive: nothing is reachable unless the host explicitly linked it in.
- fs.open / net.connect toggles — flip the host's live capability table. A call while revoked is rejected (red); the same call while granted succeeds (green) — the module's code never changes, only what the host allows it to reach.