Files
Marcos Paulo a31eb59678 feat(plugins): sandboxed wasmi plugin host
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-13 19:24:35 -03:00

25 lines
1.0 KiB
WebAssembly Text Format

;; Calls one `ns` host call in a tight loop: the rate limit must stop it.
(module
(import "ns" "notice" (func $notice (param i32 i32) (result i64)))
(memory (export "memory") 32)
(data (i32.const 2048) "spam")
(global $bump (mut i32) (i32.const 1048576))
(func (export "ns_alloc") (param $n i32) (result i32)
(local $p i32)
(local.set $p (global.get $bump))
(global.set $bump (i32.add (local.get $p) (local.get $n)))
(local.get $p))
(func (export "ns_free") (param i32) (param i32))
(func (export "ns_abi_version") (result i32) (i32.const 1))
(func (export "ns_on_load") (result i32) (i32.const 0))
(func (export "ns_on_unload") (result i32) (i32.const 0))
(func (export "ns_on_event") (param i32) (param i32) (result i32) (i32.const 0))
(func $storm (result i64)
(loop $l
(drop (call $notice (i32.const 2048) (i32.const 4)))
(br $l))
(i64.const 0))
(func (export "ns_run_command") (param i32) (param i32) (param i32) (param i32) (result i64)
(call $storm))
)