From d341f57a0caf409d7dcc258b396cdee2080be399 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 3 Jul 2020 17:30:27 +0200 Subject: [PATCH] mov: fix video extradata reading --- nihav-commonfmt/src/demuxers/mov.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nihav-commonfmt/src/demuxers/mov.rs b/nihav-commonfmt/src/demuxers/mov.rs index 24431f9..19a602f 100644 --- a/nihav-commonfmt/src/demuxers/mov.rs +++ b/nihav-commonfmt/src/demuxers/mov.rs @@ -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 { -- 2.39.5