]> git.nihav.org Git - nihav.git/commitdiff
rv10: check quantiser
authorKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 7 Apr 2020 14:33:48 +0000 (16:33 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 7 Apr 2020 14:34:46 +0000 (16:34 +0200)
nihav-realmedia/src/codecs/rv10.rs

index 7cfc4c360a2d8277a8cae02e9bfc47229700a15f..be4c76d113366349742a2d461d3b6e5b178cd261 100644 (file)
@@ -258,6 +258,7 @@ impl<'a> BlockDecoder for RealVideo10BR<'a> {
                     if dquant {
                         let idx = br.read(2)? as usize;
                         q = ((q as i16) + (H263_DQUANT_TAB[idx] as i16)) as u8;
                     if dquant {
                         let idx = br.read(2)? as usize;
                         q = ((q as i16) + (H263_DQUANT_TAB[idx] as i16)) as u8;
+                        validate!(q < 32);
                     }
                     Ok(BlockInfo::new(Type::I, cbp, q))
                 },
                     }
                     Ok(BlockInfo::new(Type::I, cbp, q))
                 },
@@ -276,6 +277,7 @@ impl<'a> BlockDecoder for RealVideo10BR<'a> {
                         if dquant {
                             let idx = br.read(2)? as usize;
                             q = ((q as i16) + (H263_DQUANT_TAB[idx] as i16)) as u8;
                         if dquant {
                             let idx = br.read(2)? as usize;
                             q = ((q as i16) + (H263_DQUANT_TAB[idx] as i16)) as u8;
+                            validate!(q < 32);
                         }
                         let binfo = BlockInfo::new(Type::I, cbp, q);
                         return Ok(binfo);
                         }
                         let binfo = BlockInfo::new(Type::I, cbp, q);
                         return Ok(binfo);
@@ -289,6 +291,7 @@ impl<'a> BlockDecoder for RealVideo10BR<'a> {
                     if dquant {
                         let idx = br.read(2)? as usize;
                         q = ((q as i16) + (H263_DQUANT_TAB[idx] as i16)) as u8;
                     if dquant {
                         let idx = br.read(2)? as usize;
                         q = ((q as i16) + (H263_DQUANT_TAB[idx] as i16)) as u8;
+                        validate!(q < 32);
                     }
                     let mut binfo = BlockInfo::new(Type::P, cbp, q);
                     if !is_4x4 {
                     }
                     let mut binfo = BlockInfo::new(Type::P, cbp, q);
                     if !is_4x4 {