code wiki / _hdl_build / nx_cap_detect_lib.nx

nx_cap_detect_lib.nx

buildroot/runtime/_hdl_build/nx_cap_detect_lib.nx

6631 B138 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic cap
docsdependenciesstructsconstsfunctions

about

nx_cap_detect_lib.nx -- the SILENT-TRUNCATION CAP detector CORE, shared (DRY, rule 15) by the CLI sweep (nx_janitor_caps) and the gate (nx_janitor_caps_gate). Pure text analysis over a .nx source buffer; no syscalls, no I/O -- the caller supplies the bytes. The detector flags the exact bug class that caused the seg-store "stored-not-served" outage: a fixed-count array whose literal count ALSO bounds a fill loop, in a file that reads an unbounded source. See nx_janitor_caps.nx for the full rationale. license_tier: ORIGINAL | genealogy_id: nishi_cap_detect_lib_2026_07_15

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_cap_detect_lib.nx nx_janitor_caps.nx nx_janitor_caps_gate.nx

imports: nx_syscalls.nx

imported by: nx_janitor_caps.nxnx_janitor_caps_gate.nx

structs

none

consts

10const JC_MIN_COUNT: i64 = 32

functions

13func jc_match_at(buf: *u8, pos: i64, pat: *u8, plen: i64) -> i64
17func jc_find_sub(buf: *u8, n: i64, pat: *u8, plen: i64) -> i64
called by 1: jc_has_src calls 1: jc_match_at
22func jc_has_src(buf: *u8, n: i64) -> i64
called by 2: jc_walkgg_would_flag calls 1: jc_find_sub
32func jc_lit_after(buf: *u8, n: i64, pos: i64, N: i64) -> i64
called by 1: jc_has_bound
48func jc_has_bound(buf: *u8, n: i64, N: i64) -> i64
called by 1: jc_mmap_scan calls 1: jc_lit_after
70func jc_strip_noncode(src: *u8, n: i64, dst: *u8) -> i64
called by 1: jc_walk
106func jc_mmap_scan(buf: *u8, n: i64) -> i64