From 0f34080436833fabb1c0d9058c35cb988ce091fa Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 11 Feb 2026 18:29:39 +0100 Subject: [PATCH] rawvideo_ms: reject too short input --- nihav-commonfmt/src/codecs/rawvideo_ms.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nihav-commonfmt/src/codecs/rawvideo_ms.rs b/nihav-commonfmt/src/codecs/rawvideo_ms.rs index 7e54578..e6ced10 100644 --- a/nihav-commonfmt/src/codecs/rawvideo_ms.rs +++ b/nihav-commonfmt/src/codecs/rawvideo_ms.rs @@ -32,6 +32,8 @@ impl NADecoder for RawDecoder { return Err(DecoderError::InvalidData); } let depth = if vinfo.format.is_paletted() { 8 } else { vinfo.format.get_total_depth() } as usize; + let stride = (width * depth + 31) / 32 * 4; + validate!(src.len() >= stride * height); let buf = match depth { 8 => { for sd in pkt.side_data.iter() { -- 2.39.5