From: Kostya Shishkov <kostya.shishkov@gmail.com>
Date: Fri, 14 Oct 2022 16:22:13 +0000 (+0200)
Subject: avi: ignore ODML 'ix' chunks at the beginning of 'movi' list
X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=51382a9ad683e7b4d5907f63cd8e103f531f577c;p=nihav.git

avi: ignore ODML 'ix' chunks at the beginning of 'movi' list
---

diff --git a/nihav-commonfmt/src/demuxers/avi.rs b/nihav-commonfmt/src/demuxers/avi.rs
index 2329ae9..c4b4817 100644
--- a/nihav-commonfmt/src/demuxers/avi.rs
+++ b/nihav-commonfmt/src/demuxers/avi.rs
@@ -140,11 +140,16 @@ impl<'a> DemuxCore<'a> for AVIDemuxer<'a> {
                 continue;
             }
             if (tag[0] == b'i' && tag[1] == b'x') || (&tag == b"idx1") {
+                let idx_pos = self.src.tell() - 8;
                 if !self.odml {
                     return Err(EOF);
                 }
                 self.src.read_skip(size)?;
-                self.try_next_odml_chunk()?;
+                if idx_pos > self.movi_pos {
+                    self.try_next_odml_chunk()?;
+                } else {
+                    self.movi_pos = self.src.tell();
+                }
                 continue;
             }
             if tag[0] < b'0' || tag[0] > b'9' || tag[1] < b'0' || tag[1] > b'9' {