]> git.nihav.org Git - nihav.git/commitdiff
smc: fix repeat-two-blocks case
authorKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 10 Aug 2021 10:54:57 +0000 (12:54 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 10 Aug 2021 10:54:57 +0000 (12:54 +0200)
nihav-qt/src/codecs/smc.rs

index 401b3c49b6885461e341d12aaaca5d836aba57ba..5364b08e680b3c7b0bbf2360d0bb7c5fb371e9d2 100644 (file)
@@ -119,7 +119,8 @@ impl NADecoder for SmcDecoder {
                     llblock = lblock;
                 },
                 2 => {
-                    for i in 0..len {
+                    validate!(blockpos + len * 2 <= nblocks);
+                    for i in 0..len*2 {
                         if (i & 1) == 0 {
                             Self::put_block(&mut frm.data[doff + x..], stride, &llblock);
                         } else {
@@ -131,6 +132,7 @@ impl NADecoder for SmcDecoder {
                             doff += stride * 4;
                         }
                     }
+                    blockpos += len;
                 },
                 3 => {
                     let clr             = br.read_byte()?;