From 5289bd5da9dc82aaefd9ee0c7b4ee33ec43a2595 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 9 Nov 2024 13:02:45 +0100 Subject: [PATCH] rmdemux: add some checks --- nihav-realmedia/src/demuxers/realmedia.rs | 2 ++ 1 file changed, 2 insertions(+) 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 { -- 2.39.5