Matter smart home protocol implementation for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): resolve E718 missing gen_corpus.ml and E720 multiple fuzz stanzas

Add gen_corpus.ml with domain-appropriate seed data for hap, homebrew,
hostname, json-logs, jsonwt, ltp, and matter fuzz directories. Merge
matter's two fuzz executables (fuzz_tlv, fuzz_case) into a single fuzz
runner via fuzz.ml wrapper.

+34
+5
fuzz/fuzz.ml
··· 1 + (** Fuzz runner for Matter TLV and CASE modules. *) 2 + 3 + let () = 4 + Fuzz_tlv.run (); 5 + Fuzz_case.run ()
+29
fuzz/gen_corpus.ml
··· 1 + (** Generate seed corpus for Matter fuzz testing. *) 2 + 3 + let () = 4 + (try Unix.mkdir "corpus" 0o755 5 + with Unix.Unix_error (Unix.EEXIST, _, _) -> ()); 6 + let write name data = 7 + let oc = open_out_bin (Filename.concat "corpus" name) in 8 + output_string oc data; 9 + close_out oc 10 + in 11 + (* Empty input *) 12 + write "seed_000" ""; 13 + (* Minimal TLV: anonymous signed int 1 byte, value=0 *) 14 + write "seed_001" "\x00\x00"; 15 + (* TLV boolean true: control=0x09 *) 16 + write "seed_002" "\x09"; 17 + (* TLV boolean false: control=0x08 *) 18 + write "seed_003" "\x08"; 19 + (* TLV null: control=0x14 *) 20 + write "seed_004" "\x14"; 21 + (* TLV UTF-8 string, 1-byte length, "hello" *) 22 + write "seed_005" "\x0c\x05hello"; 23 + (* TLV structure with one element *) 24 + write "seed_006" "\x15\x00\x2a\x18"; 25 + (* Truncated data *) 26 + write "seed_007" "\x0c\xff"; 27 + (* Sigma1-like: random bytes for CASE decode *) 28 + write "seed_008" (String.init 128 (fun i -> Char.chr (i mod 256))); 29 + print_endline "Generated 9 seed files in corpus/"