fix: use trim_mkb in resolve_vid_only to avoid zeroing unrecognised MKB

This commit is contained in:
Matthew Jackson
2026-06-24 00:48:02 -07:00
parent 4c50ca2122
commit 6268f6e5d9
+6 -7
View File
@@ -296,17 +296,16 @@ impl Disc {
// processing-key `decrypt_with` derivation consume, and which a key // processing-key `decrypt_with` derivation consume, and which a key
// source ships to an online service — is the full 128 MiB pad, not the // source ships to an online service — is the full 128 MiB pad, not the
// ~few-MB record stream. // ~few-MB record stream.
let mut mkb_bytes = udf_fs let mkb_bytes = udf_fs
.read_file(reader, "/AACS/MKB_RO.inf") .read_file(reader, "/AACS/MKB_RO.inf")
.or_else(|_| udf_fs.read_file(reader, "/AACS/MKB_RW.inf")) .or_else(|_| udf_fs.read_file(reader, "/AACS/MKB_RW.inf"))
.ok() .ok()
.unwrap_or_default(); .unwrap_or_default();
// Trim to the real record length. truncate is a no-op when n >= // Trim to the real record length. Use trim_mkb rather than a raw
// len and correctly empties the vec when n == 0 (zeroed/corrupt // truncate: trim_mkb only truncates when content_len > 0 and strictly
// MKB), so it never leaves the full ~128 MiB zero-pad on // inside the buffer, so a malformed/unrecognised MKB is preserved
// AacsState.mkb. // intact instead of being zeroed by truncate(0).
let n = aacs::mkb_content_len(&mkb_bytes); let mkb_bytes = aacs::trim_mkb(mkb_bytes);
mkb_bytes.truncate(n);
let mkb_ver = aacs::mkb_version(&mkb_bytes); let mkb_ver = aacs::mkb_version(&mkb_bytes);
tracing::debug!( tracing::debug!(