audit: clamp BD format fallback, running GOP byte counter, O(1) DTS marks

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

- detect_disc_format's BDMV fallback passed detect_format's result
  through unchanged, so an SD bonus/menu title could tag a BD-tree disc as
  DVD (mis-sizing the ECC sweep) — violating its own "never below Blu-ray"
  invariant. Clamp anything but UHD up to Blu-ray.
- Track the MPEG-2 GOP byte total incrementally instead of re-summing the
  whole gop_buf on every pushed picture (was O(pictures²) on any MPEG-2
  disc, not just adversarial input).
- Back the DTS pts_marks deque with a VecDeque so the over-cap prune is an
  O(1) pop_front, not an O(n) Vec::remove(0).
- Add a test exercising parse_stream_id_extension's PTS/DTS skip branches
  (the real AU-opening 0xFD video PES path) — previously untested.
This commit is contained in:
Matthew Jackson
2026-07-09 19:27:01 -07:00
parent 92e3b41468
commit 6a0e61d415
4 changed files with 59 additions and 10 deletions
+7 -3
View File
@@ -2142,10 +2142,14 @@ impl Disc {
None => {}
}
}
// Unencrypted / unreadable MKB: refine by resolution, default BD.
// Unencrypted / unreadable MKB: refine by resolution, but a BD-tree
// disc is never below Blu-ray — only UHD can promote it. detect_format
// is a general resolution classifier that can return Dvd for an SD
// bonus/menu title, which must NOT tag a BDMV disc as DVD (that
// mis-sizes the ECC-block sweep). Clamp anything but UHD up to BluRay.
return match Self::detect_format(titles) {
DiscFormat::Unknown => DiscFormat::BluRay,
other => other,
DiscFormat::Uhd => DiscFormat::Uhd,
_ => DiscFormat::BluRay,
};
}
if udf_fs.find_dir("/HVDVD_TS").is_some() {