code wiki / (root) / nx_ico_gate.nx

nx_ico_gate.nx

buildroot/runtime/nx_ico_gate.nx

8491 B190 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic ico
docsdependenciesstructsconstsfunctions

about

nx_ico_gate.nx -- proves the ICO writer/reader pair by ROUND-TRIP. T1 pins ZERO MEANS 256 in both directions. The width and height fields are one byte, so 256 -- the standard modern favicon size -- is stored as 0. A reader taking the byte at face value reports a 256x256 icon as 0x0, and this is the single most common ICO bug: it appears at exactly the one size that matters most today and nowhere else. T4 proves the payload sniff. Nothing in the directory says whether an entry is a DIB or a PNG, both are legal in the same file, and the bitCount field is routinely zero or wrong for PNG entries. The test builds a mixed file and requires each entry to be classified from its own bytes. T6 covers the crafted-file case: an entry whose offset or length points past the buffer, or back into the directory, must be REFUSED rather than followed. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_ico.nx nx_ico_gate.nx

imports: nx_syscalls.nxnx_ico.nx

imported by: nobody (leaf or entry point)

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

main nx_ico_dim_decode nx_ico_dim_encode sys_mmap nx_ico_write_begin nx_ico_w16 nx_ico_write_entry nx_ico_dim_encode ↻ nx_ico_w16 ↻ nx_ico_w32 nx_ico_count nx_ico_r16 nx_ico_at nx_ico_read_entry nx_ico_count ↻ nx_ico_r32 nx_ico_at ↻ nx_ico_dim_decode ↻ nx_ico_at ↻ nx_ico_r16 ↻ nx_ico_is_png nx_ico_at ↻ nx_ico_best nx_ico_count ↻ sys_mmap ↻ nx_ico_read_entry ↻ nx_ico_w32 ↻ g_puts sys_write sys_exit g_putn sys_mmap ↻ g_puts ↻ sys_write ↻

structs

none

consts

none

functions

22func g_puts(s: *u8) -> i64
called by 2: g_putnmain calls 1: sys_write
29func g_putn(v: i64) -> i64
called by 1: main calls 3: sys_mmapg_putssys_write
43func main() -> i64