code wiki / _hdl_build / nx_wasm_fitfixture.nx

nx_wasm_fitfixture.nx

buildroot/runtime/_hdl_build/nx_wasm_fitfixture.nx

2925 B50 linesdepth 0pulls 0 transitivereach 0 importersview sourcekind orphan librarytopic wasm
docsdependenciesstructsconstsfunctions

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

25const FIX_PAGE_BYTES: i64 = 65536
26const FIX_PAGES: i64 = 192
27const FIX_MEM_BYTES: i64 = FIX_PAGES * FIX_PAGE_BYTES
32const FIX_W: i64 = 1200
33const FIX_H: i64 = 750
34const FIX_FB_BYTES: i64 = FIX_W * FIX_H * 8
37const FIX_OVERRUN_BYTES: i64 = 8
38const FIX_OFF: i64 = FIX_MEM_BYTES - FIX_FB_BYTES + FIX_OVERRUN_BYTES

functions

40func ww() -> i64 { return FIX_W }
41func hh() -> i64 { return FIX_H }
42func fb_off() -> i64 { return FIX_OFF }
48func render() -> i64 { return 0 }
50func main() -> i64 { return 0 }