code wiki / _hdl_build / nx_wasm_fitfixture.nx
nx_wasm_fitfixture.nx
buildroot/runtime/_hdl_build/nx_wasm_fitfixture.nx
about
nx_wasm_fitfixture.nx -- A DELIBERATELY BROKEN WASM MODULE. It exists to be REFUSED.
WHY THIS FILE EXISTS. nx_wasm_vm_verify decides whether a shipped module's framebuffer lies inside
the linear memory it declares. On 2026-08-14 that verifier had a defect of its own: gv_verdict
tests ctr[2] (preconditions missing) BEFORE it compares passed-vs-run and returns 3/SKIP, so a
module that FAILED the fit check and then hit the frame-affordability abstention was reported as
"I could not look" instead of "this is broken". The one failure the tool was built to catch was the
one failure it could not report. A census reading exit codes would have scored it as an honest
abstention and gone green.
A GREEN THAT NEVER HAD A CORRESPONDING RED IS UNVERIFIED, so the fix ships with the input that
must produce the RED. This module triggers BOTH conditions AT ONCE -- that simultaneity IS the
test, because either one alone is handled correctly even by the defective version:
* its framebuffer ends beyond the declared linear memory -> the fit check must FAIL
* its frame is far larger than the interpreter budget -> the abstention would otherwise fire
A verifier that reports SKIP on this file has the bug. A verifier that reports RED does not.
★THE OVERRUN IS DERIVED, NOT CHOSEN. FIX_OFF is computed so the framebuffer ends exactly ONE PIXEL
past the end of memory. A hand-picked "obviously too big" offset would prove only that a gross
violation is caught; the tightest possible violation is the one that says the boundary arithmetic
itself is right. It also means this fixture cannot silently stop being a violation if the page
count changes -- the relationship is expressed, not the number.
license_tier: ORIGINAL
dependencies 0 imports · 0 importers
imports: none
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 25 | const FIX_PAGE_BYTES: i64 = 65536 |
| 26 | const FIX_PAGES: i64 = 192 |
| 27 | const FIX_MEM_BYTES: i64 = FIX_PAGES * FIX_PAGE_BYTES |
| 32 | const FIX_W: i64 = 1200 |
| 33 | const FIX_H: i64 = 750 |
| 34 | const FIX_FB_BYTES: i64 = FIX_W * FIX_H * 8 |
| 37 | const FIX_OVERRUN_BYTES: i64 = 8 |
| 38 | const FIX_OFF: i64 = FIX_MEM_BYTES - FIX_FB_BYTES + FIX_OVERRUN_BYTES |
functions
| 40 | func ww() -> i64 { return FIX_W } |
| 41 | func hh() -> i64 { return FIX_H } |
| 42 | func fb_off() -> i64 { return FIX_OFF } |
| 48 | func render() -> i64 { return 0 } |
| 50 | func main() -> i64 { return 0 } |