SquashFS compressed filesystem reader in pure OCaml
0
fork

Configure Feed

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

refactor(crowbar): Alcotest-style API with suite exports and grouped run

- Change `run` signature to `string -> (string * test_case list) list -> unit`
matching Alcotest's grouping convention
- Fix `_name` bug: pass the name through to Alcotest.run_with_args
- Each fuzz module now exports `let suite = ("name", [test_case ...])`
- Entry points (fuzz.ml) collect suites: `Crowbar.run "pkg" [Fuzz_X.suite]`
- Remove stale `add_test`/`suite` API, keep only `test_case`/`run`
- Remove `let run () = ()` from fuzz_common.ml files
- Update merlint E725 rule to match new `let suite = ("name", ...)` pattern
- Update E725 test fixtures and expected output

+31 -35
+31 -35
fuzz/fuzz_squashfs.ml
··· 239 239 | Error e -> failf "compressed image not valid: %s" e 240 240 end 241 241 242 - let () = 243 - (* Reader tests *) 244 - add_test ~name:"squashfs: no crash on arbitrary input" [ bytes ] test_no_crash; 245 - add_test ~name:"squashfs: handle corrupted data after magic" [ bytes ] 246 - test_corrupted_after_magic; 247 - add_test ~name:"squashfs: crafted superblock values" 248 - [ range 0x200000; range 0xffff; range 0xffff ] 249 - test_crafted_superblock; 250 - add_test ~name:"squashfs: symlink traversal detection" [ bytes ] 251 - test_symlink_traversal; 252 - add_test ~name:"squashfs: truncated input" [ range 300 ] test_truncated_input; 253 - add_test ~name:"squashfs: crafted symlink size (CVE-2024-46744)" [ int ] 254 - test_crafted_symlink_size; 255 - add_test ~name:"squashfs: decompression limit" [ bytes ] 256 - test_decompression_limit; 257 - add_test ~name:"squashfs: inode count overflow (U-Boot CVE)" [ int ] 258 - test_inode_count_overflow; 242 + let suite = 243 + ( "squashfs", 244 + [ 245 + (* Reader tests *) 246 + test_case "no crash on arbitrary input" [ bytes ] test_no_crash; 247 + test_case "handle corrupted data after magic" [ bytes ] 248 + test_corrupted_after_magic; 249 + test_case "crafted superblock values" 250 + [ range 0x200000; range 0xffff; range 0xffff ] 251 + test_crafted_superblock; 252 + test_case "symlink traversal detection" [ bytes ] test_symlink_traversal; 253 + test_case "truncated input" [ range 300 ] test_truncated_input; 254 + test_case "crafted symlink size (CVE-2024-46744)" [ int ] 255 + test_crafted_symlink_size; 256 + test_case "decompression limit" [ bytes ] test_decompression_limit; 257 + test_case "inode count overflow (U-Boot CVE)" [ int ] 258 + test_inode_count_overflow; 259 + (* Writer tests *) 260 + test_case "writer finalize no crash" [ bytes ] 261 + test_writer_finalize_no_crash; 262 + test_case "writer roundtrip" [ bytes ] test_writer_roundtrip; 263 + test_case "writer multiple files" [ bytes; bytes; bytes ] 264 + test_writer_multiple_files; 265 + test_case "writer nested dirs" [ range 15 ] test_writer_nested_dirs; 266 + test_case "writer symlink validation" [ bytes ] 267 + test_writer_symlink_validation; 268 + test_case "writer device nodes" [ int; int ] test_writer_device; 269 + test_case "writer large file" [ range 1_100_000 ] test_writer_large_file; 270 + test_case "writer compression" [ range 20000 ] test_writer_compression; 271 + ] ) 259 272 260 - (* Writer tests *) 261 - add_test ~name:"squashfs writer: finalize no crash" [ bytes ] 262 - test_writer_finalize_no_crash; 263 - add_test ~name:"squashfs writer: roundtrip" [ bytes ] test_writer_roundtrip; 264 - add_test ~name:"squashfs writer: multiple files" [ bytes; bytes; bytes ] 265 - test_writer_multiple_files; 266 - add_test ~name:"squashfs writer: nested dirs" 267 - [ range 15 ] 268 - test_writer_nested_dirs; 269 - add_test ~name:"squashfs writer: symlink validation" [ bytes ] 270 - test_writer_symlink_validation; 271 - add_test ~name:"squashfs writer: device nodes" [ int; int ] test_writer_device; 272 - add_test ~name:"squashfs writer: large file" 273 - [ range 1_100_000 ] 274 - test_writer_large_file; 275 - add_test ~name:"squashfs writer: compression" 276 - [ range 20000 ] 277 - test_writer_compression 273 + let () = run "squashfs" [ suite ]