audit: cap the sparse-PTS reorder buffer, FMTS key state, zero KCD

Round-1 findings from the 10-phase release audit:

- SparsePtsReorder buffered its current GOP with no bound, draining only on
  a keyframe — an open-GOP or crafted program stream that never signals one
  could hold the whole title in RAM. Force-complete the GOP at
  MAX_GOP_FRAMES, matching the MPEG-2 parser's backstop.
- inject_unit_keys labelled a 2.1 FMTS disc as AACS 1.0 / bus-encryption
  off; FMTS is UHD-family, so synthesize the UHD version + bus encryption.
- The compiled Key Correction Data was a non-zero 16-byte constant fed into
  the Media Key derivation. Per the no-compiled-keys rule it is now all-zero;
  the chain still cannot complete on a real disc (documented), so this is
  behaviour-neutral — all variant tests pass unchanged.
- Fix stale doc references (broken `super::variants` intra-doc links, and
  `aacs::keys` comments) left by the module rename.
This commit is contained in:
Matthew Jackson
2026-07-09 14:14:20 -07:00
parent 14c4227292
commit a94f78d090
7 changed files with 51 additions and 23 deletions
+7 -5
View File
@@ -1490,9 +1490,9 @@ impl Disc {
let (capacity, mut buffered, udf_fs) = Self::read_udf(session)?;
let meta_title = Self::read_meta_title(&mut buffered, &udf_fs);
// Authoritative up front — same MKB-driven detector as the full scan
// (no titles needed: BD/UHD/FMTS come from the MKB generation). This
// no longer defaults to BluRay and defers UHD/FMTS to the full scan.
// Authoritative here — the same MKB-driven detector the full scan uses
// (no titles needed: BD/UHD/FMTS come from the MKB generation). It no
// longer defaults to BluRay or defers UHD/FMTS to the full scan.
let format = Self::detect_disc_format(&mut buffered, &udf_fs, &[]);
let encrypted =
udf_fs.find_dir("/AACS").is_some() || udf_fs.find_dir("/BDMV/AACS").is_some();
@@ -2660,13 +2660,15 @@ impl Disc {
aacs.unit_keys = keys;
aacs.key_source = KeyOrigin::ExternalUk;
} else if self.encrypted && self.css.is_none() {
// FMTS is AACS 2.1, a UHD-family (bus-encrypted) format — not BD.
let uhd_family = matches!(self.format, DiscFormat::Uhd | DiscFormat::Fmts);
self.aacs = Some(AacsState {
version: if self.format == DiscFormat::Uhd {
version: if uhd_family {
crate::aacs::mkb::AACS_MAJOR_UHD
} else {
crate::aacs::mkb::AACS_MAJOR_BD
},
bus_encryption: self.format == DiscFormat::Uhd,
bus_encryption: uhd_family,
mkb_version: None,
disc_hash: String::new(),
key_source: KeyOrigin::ExternalUk,