]> git.nihav.org Git - nihav.git/commitdiff
rawvideo_ms: reject too short input
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 11 Feb 2026 17:29:39 +0000 (18:29 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 11 Feb 2026 17:29:39 +0000 (18:29 +0100)
nihav-commonfmt/src/codecs/rawvideo_ms.rs

index 7e545784cd3ac92e254e624993f33a52aaf6f091..e6ced103d6106a8cb953fc5fc4a0113a34742ed2 100644 (file)
@@ -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() {