From: Kostya Shishkov Date: Fri, 30 Oct 2026 20:29:35 +0000 (+0100) Subject: mkv: cue entries without relative offset are valid X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=98f4ab3cfd717d27c1e2adb501db2ec77d5e25ce;p=nihav.git mkv: cue entries without relative offset are valid --- diff --git a/nihav-commonfmt/src/demuxers/mkv/mod.rs b/nihav-commonfmt/src/demuxers/mkv/mod.rs index 7f9c190..1b893d4 100644 --- a/nihav-commonfmt/src/demuxers/mkv/mod.rs +++ b/nihav-commonfmt/src/demuxers/mkv/mod.rs @@ -373,7 +373,9 @@ impl<'a> DemuxCore<'a> for MatroskaDemuxer<'a> { self.src.seek(SeekFrom::Start(end))?; } validate!(ts.is_some()); + if clu_off > 0 { self.src.seek(SeekFrom::Start(clu_start + clu_off))?; + } self.cur_seg = seg_no; self.seg_end = Some(tgt_seg.end); self.clu_end = Some(clu_end); diff --git a/nihav-commonfmt/src/demuxers/mkv/parse.rs b/nihav-commonfmt/src/demuxers/mkv/parse.rs index f32f15c..c08523d 100644 --- a/nihav-commonfmt/src/demuxers/mkv/parse.rs +++ b/nihav-commonfmt/src/demuxers/mkv/parse.rs @@ -566,8 +566,8 @@ impl CueEntry { match id { 0xF7 => { if tid.is_some() { - validate!(pos.is_some() && rpos.is_some()); - self.tracks.push((tid.unwrap(), pos.unwrap(), rpos.unwrap())); + validate!(pos.is_some()); + self.tracks.push((tid.unwrap(), pos.unwrap(), rpos.unwrap_or(0))); } let ttid = br.read_uint(size)?; validate!((1..=U32_MAX).contains(&ttid)); @@ -586,8 +586,8 @@ impl CueEntry { validate!(br.tell() <= cur_end); br.seek(SeekFrom::Start(cur_end))?; } - if tid.is_some() && pos.is_some() && rpos.is_some() { - self.tracks.push((tid.unwrap(), pos.unwrap(), rpos.unwrap())); + if tid.is_some() && pos.is_some() { + self.tracks.push((tid.unwrap(), pos.unwrap(), rpos.unwrap_or(0))); } Ok(()) }