]> git.nihav.org Git - nihav.git/commitdiff
mov: fix video extradata reading
authorKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 3 Jul 2020 15:30:27 +0000 (17:30 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 3 Jul 2020 15:30:27 +0000 (17:30 +0200)
nihav-commonfmt/src/demuxers/mov.rs

index 24431f9a7416e0a9fae179fd7256f005c942167b..19a602ffc88e53f7788c509c661edb2566b6630c 100644 (file)
@@ -554,7 +554,8 @@ fn read_stsd(track: &mut Track, br: &mut ByteReader, size: u64) -> DemuxerResult
             let edata = if br.tell() - start_pos + 4 < size {
 //todo skip various common atoms
                     let edata_size  = br.read_u32be()? as usize;
-                    let mut buf = vec![0; edata_size];
+                    validate!(edata_size >= 4);
+                    let mut buf = vec![0; edata_size - 4];
                                   br.read_buf(buf.as_mut_slice())?;
                     Some(buf)
                 } else {