From: Kostya Shishkov Date: Tue, 10 Aug 2021 10:54:57 +0000 (+0200) Subject: smc: fix repeat-two-blocks case X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=440a87948e66c392ff9d664964ea6f6953959dc6;p=nihav.git smc: fix repeat-two-blocks case --- diff --git a/nihav-qt/src/codecs/smc.rs b/nihav-qt/src/codecs/smc.rs index 401b3c4..5364b08 100644 --- a/nihav-qt/src/codecs/smc.rs +++ b/nihav-qt/src/codecs/smc.rs @@ -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()?;