]> git.nihav.org Git - nihav.git/commitdiff
mkv: cue entries without relative offset are valid
authorKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 30 Oct 2026 20:29:35 +0000 (21:29 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 30 Oct 2026 20:29:35 +0000 (21:29 +0100)
nihav-commonfmt/src/demuxers/mkv/mod.rs
nihav-commonfmt/src/demuxers/mkv/parse.rs

index 7f9c190417177bf53d5a13682fbe49254b16707a..1b893d421f7e946a36a3a97a706d8d0ecd496d30 100644 (file)
@@ -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);
index f32f15c9cb18a3a1e04ee19936e14b7cb80781b0..c08523d2fc17ec9a5ff4da8f6643d57190ef275d 100644 (file)
@@ -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(())
     }