Block device abstraction for OCaml 5 with Eio direct-style I/O and Bytesrw integration
1
fork

Configure Feed

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

fix(lint): add gen_corpus.ml to all fuzz directories for E718

Add seed corpus generators with representative test data for:
ocaml-aos, ocaml-block, ocaml-bloom, ocaml-bpsec, ocaml-bundle,
ocaml-cfdp, ocaml-cgr, ocaml-clcw, ocaml-cookeio, ocaml-cpio

+33
+5
fuzz/dune
··· 19 19 (deps fuzz_block.exe) 20 20 (action 21 21 (echo "AFL fuzzer built: %{exe:fuzz_block.exe}\n"))) 22 + 23 + (executable 24 + (name gen_corpus) 25 + (modules gen_corpus) 26 + (libraries unix))
+28
fuzz/gen_corpus.ml
··· 1 + (** Generate seed corpus for 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 + (* Single zero byte *) 14 + write "seed_001" "\x00"; 15 + (* 512-byte sector of zeros (standard sector size) *) 16 + write "seed_002" (String.make 512 '\x00'); 17 + (* 512-byte sector of 0xFF *) 18 + write "seed_003" (String.make 512 '\xFF'); 19 + (* 512-byte sector with ascending byte pattern *) 20 + write "seed_004" (String.init 512 (fun i -> Char.chr (i land 0xFF))); 21 + (* Short data for sub-sector tests *) 22 + write "seed_005" (String.make 64 '\xAB'); 23 + (* Two sectors worth of alternating pattern *) 24 + write "seed_006" 25 + (String.init 1024 (fun i -> if i mod 2 = 0 then '\xDE' else '\xAD')); 26 + (* 4096-byte sector (common large sector size) *) 27 + write "seed_007" (String.make 4096 '\x42'); 28 + print_endline "gen_corpus: wrote 8 block seed files"