Feed the CSS crack the canonical extent order, and stop Resolution faking 1080p
Seven defects in the code the test suite executes least — 913 lines of disc/mod.rs alone are run by no test at all, which is why this round scoped from coverage rather than from what previous rounds said they had read. Disc::scan_image kept its own copy of the crack's extent ordering and fed crack_key_outcome largest-cell-first. That is the fifth instance in this audit of a local reimplementation drifting from the canonical one, and the cost here is a key that does not descramble the feature: picking by sector count bypasses the capacity gate and can select a different VTS entirely. The copy is gone — which title comes from the canonical order the scan already applied, and the extents are handed over in playback order, exactly as decrypt_keys_for_title does. Its doc records why the duplicate existed so it cannot grow back. Resolution::pixels returned 1920x1080 for Unknown. That is the FOURTH instance of one trap and the other three were in this same file, two of them fixed hours earlier — without sweeping for siblings, which is the whole reason this one survived. It now returns (0, 0), and the sweep was done properly this time: every remaining Unknown arm across the crate is honest, and the two ColorSpace sites that look like fabrication are emitting H.273 code point 2, which is the spec's own "unspecified". Two callers carried local Unknown-to-zero workarounds — precisely the cost of making callers responsible for a lie — and one is now redundant. BD-ROM Part 3 code 0xA2 is the lossy secondary DTS stream, not lossless Master Audio. A test asserted the wrong mapping as intended behaviour, so correcting the code failed it; the test is deleted with a note pointing at its replacement. That is a NEW failure mode for this audit: not a test that cannot fail, but one that locks the defect in. There is no DtsExpress variant to map to, so it takes the lossy DTS-HD member and the approximation is documented. Also: DiscSession::identify could panic through drive_mut once the public API allows an absent drive — two siblings were converted in an earlier round and this one was missed; an extent end that added without saturating where the rest of the crate saturates; a diag reason string restating the comparator's sort keys and drifting from them, now derived from them; and a short read that advanced the offset by the full request, silently skipping the gap. That last one existed twice, in two reads with the same shape, now merged so they cannot drift apart. The short-read policy is a judgement call I could not derive from a spec: no skip_errors is a hard error, with skip_errors zero-fills and charges the loss. It deliberately does not retry mid-unit, because resuming inside an AACS aligned unit would trade a silent gap for a silent decrypt desync — the worse of the two.
This commit is contained in:
+12
-9
@@ -7,8 +7,12 @@
|
||||
use super::ebml;
|
||||
use super::timeline::TimelineContinuity;
|
||||
use crate::disc::{
|
||||
AudioStream, Chapter, Codec, ColorSpace, HdrFormat, Resolution, SubtitleStream, VideoStream,
|
||||
AudioStream, Chapter, Codec, ColorSpace, HdrFormat, SubtitleStream, VideoStream,
|
||||
};
|
||||
// Production code reaches resolutions only through `VideoStream::resolution`;
|
||||
// the fixtures below name the variants directly.
|
||||
#[cfg(test)]
|
||||
use crate::disc::Resolution;
|
||||
use std::io::{self, Seek, Write};
|
||||
|
||||
// ── CICP colour codes (ITU-T H.273) ──────────────────────────────────────────
|
||||
@@ -375,14 +379,13 @@ impl MkvTrack {
|
||||
// keeps a fallback rather than erroring.
|
||||
_ => ebml::CODEC_MPEG2,
|
||||
};
|
||||
// An Unknown resolution has no real dimensions — emit (0, 0) so the
|
||||
// serializer omits PixelWidth/PixelHeight (Matroska marks them
|
||||
// optional) rather than writing a fabricated 1920x1080 default.
|
||||
let (w, h) = if matches!(v.resolution, Resolution::Unknown) {
|
||||
(0, 0)
|
||||
} else {
|
||||
v.resolution.pixels()
|
||||
};
|
||||
// An Unknown resolution has no real dimensions — `pixels()` reports
|
||||
// (0, 0) for it, and the serializer then omits PixelWidth/PixelHeight
|
||||
// (Matroska marks them optional). The local `matches!(Unknown)` guard
|
||||
// that used to sit here existed only because `pixels()` fabricated a
|
||||
// 1920x1080 default; it does not any more, so the check belongs in the
|
||||
// one accessor rather than in each caller that remembered to write it.
|
||||
let (w, h) = v.resolution.pixels();
|
||||
let (num, den) = v.frame_rate.as_fraction();
|
||||
let default_duration_ns = if num > 0 {
|
||||
(1_000_000_000u64 * den as u64) / num as u64
|
||||
|
||||
Reference in New Issue
Block a user