code wiki / (root) / nx_registry_bounds_gate.nx

nx_registry_bounds_gate.nx

buildroot/runtime/nx_registry_bounds_gate.nx

5033 B93 linesdepth 6pulls 9 transitivereach 0 importersview sourcekind gate/prooftopic registry
docsdependenciesstructsconstsfunctions

about

nx_registry_bounds_gate.nx -- the regression tooth for the reg_index OUT-OF-BOUNDS WRITE root-fixed 2026-07-31 (debt 1785506176). WHAT WENT WRONG: reg_index copied ss_get's length into the caller's buffer and took NO capacity argument, so its signature could not express safety. MEASURED LIVE: the mvault mv:ids index reached ~10.7 MiB (160269 ids x 70B) against a 4 MiB buffer in nx_mvault do_stats -- the vault's own ruler segfaulted and printed NOTHING -- and against an 8 MiB buffer in the /vault browse page. WHY THIS GATE EXISTS: the old defect was invisible to every test that only checked the HAPPY path, because a copy that overruns still returns the right number. So the load-bearing test here is T3/T6: a cap one byte too small must REFUSE and must leave the byte just past the cap UNTOUCHED. That byte is exactly what the pre-fix code clobbered, so this gate is PROVEN ABLE TO FAIL rather than decorative -- revert nx_registry.nx and T3/T6 go red. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_registry.nx nx_gate.nx nx_gate_verdict.nx nx_registry_bounds_gate.nx

imports: nx_registry.nxnx_gate.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gw sys_write reg_put reg_put_x sts_lock sts_mm sys_mmap sts_werr sys_write ↻ sys_exit ss_cat sys_openat_append sts_werr ↻ sys_flock reg_key reg_cat ss_get sys_mmap ↻ ss_scan sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn ss_scan_seglist ss_len sys_mmap ↻ ss_cat ↻ ss_readall ss_r32 reg_strlen reg_id_present sts_unlock sys_flock ↻ sys_close ss_next_segid sys_mmap ↻ ss_cat ↻ ss_readall ↻ ss_segid_ok ss_begin_cap

structs

none

consts

21const RB_PFX: *u8 = "knowledge/regbounds-test-\x00"
22const RB_KP: *u8 = "rb:\x00"
23const RB_IDX: *u8 = "rb:__idx__\x00"
24const RB_CANARY: i64 = 171

functions

26func main() -> i64