code wiki / (root) / nx_imgattr_lib_gate.nx

nx_imgattr_lib_gate.nx

buildroot/runtime/nx_imgattr_lib_gate.nx

15327 B260 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_imgattr_lib_gate.nx -- the gate for nx_imgattr_lib. IN-PROCESS: it imports the lib and calls it directly, so nx_gate_bite can mutate the subject and watch teeth die. WHAT IT HAS TO PROVE: - the WRITER can never emit an img whose attributes the data can escape from, however hostile the caption is, and it REFUSES rather than emitting an img with no usable alt; - the READER can say NO. A checker that passes everything passes every test, so every positive tooth is paired with a control on markup that MUST fail; - the reader sees something the incumbent ruler cannot. nx_page_verify's a11y check counts the byte pattern - alt=- across the whole page; that rule is transcribed BY HAND below and asserted to ACQUIT the exact markup our own site serves. So is a present/absent alt test. Only the quote-break axis convicts it. That gap IS the defect, written as a test. THE ORACLES ARE INDEPENDENT ON PURPOSE. A tooth that calls the same function on both sides cannot fail, so nothing here asks ia_scan what the answer should have been: the expected values are literals, and the two foreign grammars (nx_page_verify's alt counter and its src scan) are transcribed here rather than imported. license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_imgattr_lib.nx nx_imgattr_lib_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_imgattr_lib.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ sys_mmap ↻ gv_check gv_puts ↻ ia_attr_hostile ig_build_unescaped ig_cat ig_eq ig_pv_a11y_img ig_count ia_slen ig_first_val ia_slen ↻ ig_streq ig_pv_a11y_alt ig_count ↻ ia_scan sys_mmap ↻ ia_starts_ci ia_lower ia_skip_past

structs

none

consts

23const IG_ARENA: i64 = 65536
24const IG_SMALL: i64 = 4096
28const IG_CAP_REAL: *u8 = "The card's own portrait -- the oracle we match against" as *u8
29const IG_SRC_REAL: *u8 = "/compare/koikatsu/native_kk396262.png" as *u8
30const IG_EXTRA: *u8 = "loading='lazy'" as *u8
31const IG_FILE_REAL: *u8 = "guides/kk_wubsy_mateditor_1.png" as *u8
32const IG_BLANK: *u8 = " " as *u8
34const IG_TRUNCATED_ALT: *u8 = "The card" as *u8

functions

37func ig_eq(a: i64, b: i64) -> i64 { if a == b { return 1 } return 0 }
called by 1: main
38func ig_gt(a: i64, b: i64) -> i64 { if a > b { return 1 } return 0 }
called by 1: main
39func ig_and(a: i64, b: i64) -> i64 { if a == 1 { if b == 1 { return 1 } } return 0 }
called by 1: main
41func ig_cat(d: *u8, o: i64, s: *u8) -> i64
49func ig_streq(a: *u8, b: *u8) -> i64
called by 1: main
59func ig_count(h: *u8, need: *u8) -> i64
78func ig_has(h: *u8, need: *u8) -> i64 { if ig_count(h, need) > 0 { return 1 } return 0 }
called by 1: main calls 1: ig_count
84func ig_pv_a11y_alt(page: *u8) -> i64 { return ig_count(page, " alt=" as *u8) }
called by 1: main calls 1: ig_count
85func ig_pv_a11y_img(page: *u8) -> i64 { return ig_count(page, "<img" as *u8) }
called by 1: main calls 1: ig_count
90func ig_first_val(page: *u8, key: *u8, out: *u8, cap: i64) -> i64
called by 1: main calls 1: ia_slen
126func ig_build_unescaped(d: *u8, src: *u8, capt: *u8) -> i64
called by 1: main calls 1: ig_cat
141func ig_img_unreadable(markup: *u8) -> i64
called by 1: main calls 3: sys_mmapia_scania_slen
151func main() -> i64