From: Kostya Shishkov Date: Sat, 9 Nov 2024 12:02:45 +0000 (+0100) Subject: rmdemux: add some checks X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=5289bd5da9dc82aaefd9ee0c7b4ee33ec43a2595;p=nihav.git rmdemux: add some checks --- diff --git a/nihav-realmedia/src/demuxers/realmedia.rs b/nihav-realmedia/src/demuxers/realmedia.rs index 15738b5..521f238 100644 --- a/nihav-realmedia/src/demuxers/realmedia.rs +++ b/nihav-realmedia/src/demuxers/realmedia.rs @@ -586,6 +586,8 @@ println!("unknown MLTI substream {:08X} / {:08X}", tag, tag2); let hdr_skip = (src.tell() - pos) as usize; let slice_size = payload_size - hdr_skip; + validate!(packet_num as usize <= num_pkts); + validate!(off as usize + slice_size <= (frame_size as usize)); slice_buf.resize(slice_size, 0); src.read_buf(slice_buf.as_mut_slice())?; if packet_num == 1 {