code wiki / (root) / fuzz_parse_test.nx

fuzz_parse_test.nx

buildroot/runtime/fuzz_parse_test.nx

4732 B120 linesdepth 6pulls 14 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

fuzz_parse_test.nx -- mutational fuzz against parse_module. FINDING (2026-04-24 first run of this harness): Mutated input derived from the 'add' seed reliably hangs parse_module under qemu. Timeout >60s at iteration 1. The lexer completes (lex done fires); parse_function enters (per-function name marker fires: 'add :'), then never returns. This is an infinite loop in parse -- a real, previously undetected vulnerability to malformed input. Root-cause investigation: follow-up commit using the new nx_panic_ctx + memcap + guards + GDB-via-qemu infra. Likely similar structurally to the skip_ws_comments '/' infinite-loop we found at bootstrap stage-2. This file is currently configured with ITERS=0 to keep the F6 gate green. When the parser is hardened against mutation- induced hangs, bump ITERS back up and keep it as a regression harness. The VALUE of this file: it documents a live parser vulnerability that must be fixed before NishiLang is safe to run on untrusted input (life-or-death requirement). Parse-fuzz is re-enabled by raising FUZZ_ITERS in the const below once the underlying hang is fixed.

dependencies 6 imports · 0 importers

syscalls.nx types.nx lex_kinds.nx lex.nx parse.nx nx_fuzz.nx fuzz_parse_test.nx

imports: syscalls.nxtypes.nxlex_kinds.nxlex.nxparse.nxnx_fuzz.nx

imported by: nobody (leaf or entry point)

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

main nx_fuzz_new nx_fuzz_add_seed nx_fuzz_mutate nx_fuzz_rand_range nx_fuzz_copy_seed nx_fuzz_op_bit_flip nx_fuzz_rand_range ↻ nx_fuzz_op_byte_set nx_fuzz_rand_range ↻ nx_fuzz_rand_i64 nx_fuzz_op_insert nx_fuzz_rand_range ↻ nx_fuzz_rand_i64 ↻ nx_fuzz_op_delete nx_fuzz_rand_range ↻ nx_fuzz_op_arith nx_fuzz_rand_range ↻ lex_source skip_ws_comments peek advance peek2 peek ↻ is_alpha lex_ident_or_kw tok_text_ptr peek ↻ is_alnum is_alpha ↻ is_digit advance ↻ keyword_lookup push_tok is_digit ↻ lex_number peek ↻ peek2 ↻ advance ↻ is_hexdigit

structs

none

consts

54const FUZZ_ITERS: i64 = 100
55const FUZZ_MAX_INPUT: i64 = 128

functions

57func main() -> i64 {