Audit round 2 fixes: an unsafe default, four omissions, and two swallowed errors
The folder encryption probe returned "not encrypted" when it had sampled nothing at all — a title shorter than one aligned unit skipped the loop entirely. That verdict CLEARS the structural one an AACS directory raised, so a genuinely encrypted folder would have been ripped as clear and written ciphertext as video at exit 0. With no evidence it now keeps the structural verdict, and its bounds arithmetic no longer trusts disc-derived values not to wrap. Reading an IFO header swallowed every I/O error and returned an empty buffer, which sent each placement offset through unwrap_or(0) and recorded no constraint at all — a permission error on one file produced a silently misplaced VOB. The directory walk swallowed the same class while claiming to skip only vanished files. Both now propagate; only NotFound is skipped. Four things the round-1 changes left inconsistent: two new error codes had no doc comments, were absent from the io::Error mapping, printed no path in Display, and were missing from the test that proves codes are distinct. The demux sink dropped frames silently while the MKV muxer reported them. And set_clips had been inserted INTO write_frame's doc comment, leaving write_frame undocumented and its paragraphs describing the wrong function. uid/gid used 0 as "not specified"; UDF's sentinel is 0xFFFFFFFF, and 0 is root.
This commit is contained in:
@@ -434,8 +434,11 @@ fn file_entry(
|
||||
// s[34..36] ICB flags: 0 => short allocation descriptors. `udf.rs:601`
|
||||
// reads exactly this word to pick its AD stride.
|
||||
s[34..36].copy_from_slice(&0u16.to_le_bytes());
|
||||
s[36..40].copy_from_slice(&0u32.to_le_bytes()); // uid: invalid/none
|
||||
s[40..44].copy_from_slice(&0u32.to_le_bytes()); // gid: invalid/none
|
||||
// UDF's sentinel for "not specified" is 0xFFFFFFFF, not 0 — 0 is a real
|
||||
// uid/gid (root). A synthesized image has no meaningful owner, and a driver
|
||||
// that maps these through would otherwise report every file as root-owned.
|
||||
s[36..40].copy_from_slice(&u32::MAX.to_le_bytes()); // uid: not specified
|
||||
s[40..44].copy_from_slice(&u32::MAX.to_le_bytes()); // gid: not specified
|
||||
s[44..48].copy_from_slice(&PERM_R_X.to_le_bytes());
|
||||
s[48..50].copy_from_slice(&link_count.to_le_bytes());
|
||||
s[56..64].copy_from_slice(&info_len.to_le_bytes());
|
||||
|
||||
Reference in New Issue
Block a user