SquashFS compressed filesystem reader in pure OCaml
0
fork

Configure Feed

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

squashfs: shorten test names (merlint E335)

+10 -10
+10 -10
test/test_hostile.ml
··· 94 94 95 95 (* Writer does NOT validate symlink targets (only paths). Verify that 96 96 is_path_traversal would catch a dangerous target that the writer allows. *) 97 - let test_writer_allows_dangerous_symlink_target () = 97 + let test_writer_dangerous_symlink () = 98 98 let fs = Writer.v () in 99 99 (* This should succeed -- writer only validates the path, not the target *) 100 100 Writer.add_symlink fs "link" "../etc/passwd"; ··· 104 104 (Squashfs.is_path_traversal "../etc/passwd") 105 105 106 106 (* safe_read_link rejects traversal in target read from image *) 107 - let test_safe_read_link_rejects_traversal () = 107 + let test_safe_readlink_traversal () = 108 108 let t = 109 109 image (fun fs -> 110 110 Squashfs.Writer.add_file fs "f" ~mode:0o644 "x"; ··· 151 151 152 152 (* root_inode_ref pointing to offset 0 (the superblock itself) -- the inode 153 153 parser should reject the garbage data rather than loop *) 154 - let test_root_inode_ref_to_superblock () = 154 + let test_root_inode_superblock () = 155 155 let buf = minimal_superblock () in 156 156 (* root_inode_ref at offset 32 (u64_le): set to 0 *) 157 157 Bytes.set buf 32 '\x00'; ··· 193 193 | Ok _ -> () 194 194 195 195 (* block_size = max+1 must be rejected *) 196 - let test_block_size_just_over_max () = 196 + let test_blocksize_over_max () = 197 197 let buf = minimal_superblock () in 198 198 (* block_size = 1048577 (0x100001) *) 199 199 Bytes.set buf 12 '\x01'; ··· 205 205 | Ok _ -> Alcotest.fail "should reject block_size > 1MB" 206 206 207 207 (* read_file with max_size=0 should reject even an empty-ish file inode *) 208 - let test_read_file_max_size_zero () = 208 + let test_read_maxsize_zero () = 209 209 let t = 210 210 image (fun fs -> 211 211 Squashfs.Writer.add_file fs "big.txt" ~mode:0o644 (String.make 100 'x')) ··· 275 275 Alcotest.test_case "traversal: redundant slashes" `Quick 276 276 test_traversal_redundant_slashes; 277 277 Alcotest.test_case "writer allows dangerous symlink target" `Quick 278 - test_writer_allows_dangerous_symlink_target; 278 + test_writer_dangerous_symlink; 279 279 Alcotest.test_case "safe_read_link rejects traversal" `Quick 280 - test_safe_read_link_rejects_traversal; 280 + test_safe_readlink_traversal; 281 281 (* Fragment table bounds *) 282 282 Alcotest.test_case "fragment table beyond image" `Quick 283 283 test_fragment_table_beyond_image; ··· 285 285 test_fragment_count_mismatch; 286 286 (* Inode cycle/self-reference *) 287 287 Alcotest.test_case "root inode ref to superblock" `Quick 288 - test_root_inode_ref_to_superblock; 288 + test_root_inode_superblock; 289 289 Alcotest.test_case "root inode ref huge" `Quick test_root_inode_ref_huge; 290 290 (* Compression bomb limits *) 291 291 Alcotest.test_case "max block_size accepted" `Quick 292 292 test_max_block_size_accepted; 293 293 Alcotest.test_case "block_size just over max" `Quick 294 - test_block_size_just_over_max; 294 + test_blocksize_over_max; 295 295 Alcotest.test_case "read_file max_size=0" `Quick 296 - test_read_file_max_size_zero; 296 + test_read_maxsize_zero; 297 297 (* Misc hostile superblock *) 298 298 Alcotest.test_case "bytes_used = 0" `Quick test_bytes_used_zero; 299 299 Alcotest.test_case "bytes_used > data" `Quick test_bytes_used_exceeds_data;