indeo5: fix band size check
authorKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 13 Oct 2022 16:21:33 +0000 (18:21 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 13 Oct 2022 16:22:10 +0000 (18:22 +0200)
nihav-indeo/src/codecs/indeo5.rs

index ec23981857dfeaf5dbd767289619296ac818d6bb..0c6d65eeed8c48d9dcbf1b89969fb07c5505adfe 100644 (file)
@@ -180,10 +180,11 @@ impl IndeoXParser for Indeo5Parser {
         let data_size: usize;
         if (band_flags & 0x80) != 0 {
             data_size       = br.read(24)? as usize;
+            validate!(data_size >= 4);
         } else {
             data_size = 0;
         }
-        validate!(data_size <= ((br.left() / 8) as usize));
+        validate!(data_size <= ((br.left() / 8) as usize) + 4);
 
         let num_corr: usize;
         let mut corr_map: [u8; CORR_MAP_SIZE] = [0; CORR_MAP_SIZE];