From: Kostya Shishkov Date: Sun, 24 May 2020 13:18:40 +0000 (+0200) Subject: avi: do not put extradata size into extradata for audio streams X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=f8d697207ac1373091df74002bdc72fd5b2d8944;p=nihav.git avi: do not put extradata size into extradata for audio streams --- diff --git a/nihav-commonfmt/src/demuxers/avi.rs b/nihav-commonfmt/src/demuxers/avi.rs index f108e3c..4ea4067 100644 --- a/nihav-commonfmt/src/demuxers/avi.rs +++ b/nihav-commonfmt/src/demuxers/avi.rs @@ -448,7 +448,14 @@ fn parse_strf_auds(dmx: &mut AVIDemuxer, strmgr: &mut StreamManager, size: usize let soniton = NASoniton::new(bits_per_sample as u8, SONITON_FLAG_SIGNED); let ahdr = NAAudioInfo::new(samplespersec, channels as u8, soniton, block_align as usize); - let edata = dmx.read_extradata(size - 16)?; + let edata; + if size > 16 { + let edata_size = dmx.src.read_u16le()? as usize; + validate!(edata_size + 18 == size); + edata = dmx.read_extradata(size - 18)?; + } else { + edata = None; + } let cname = match register::find_codec_from_wav_twocc(w_format_tag) { None => "unknown", Some(name) => name,