From: Kostya Shishkov Date: Fri, 24 Feb 2023 17:25:02 +0000 (+0100) Subject: realmedia: parse the original RealAudio files with even shorter v3 header X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=0d9dc164b091428c4d23637c4996c430bbc09f2c;p=nihav.git realmedia: parse the original RealAudio files with even shorter v3 header --- diff --git a/nihav-realmedia/src/demuxers/realmedia.rs b/nihav-realmedia/src/demuxers/realmedia.rs index 45c117a..14183c9 100644 --- a/nihav-realmedia/src/demuxers/realmedia.rs +++ b/nihav-realmedia/src/demuxers/realmedia.rs @@ -846,10 +846,15 @@ fn parse_aformat3(src: &mut ByteReader) -> DemuxerResult { skip_ra_metadata(src)?; - let _can_copy = src.read_byte()?; - let fcc_len = src.read_byte()?; - validate!(fcc_len == 4); - let fcc = src.read_u32be()?; + // the original RealAudio has no such fields + let fcc = if src.tell() != start + u64::from(header_len) + 2 { + let _can_copy = src.read_byte()?; + let fcc_len = src.read_byte()?; + validate!(fcc_len == 0 || fcc_len == 4); + src.read_u32be()? + } else { + read_u32be(b"lpcJ")? + }; let end = src.tell(); validate!(end - start <= (header_len as u64) + 2);