From 440a87948e66c392ff9d664964ea6f6953959dc6 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 10 Aug 2021 12:54:57 +0200 Subject: [PATCH] smc: fix repeat-two-blocks case --- nihav-qt/src/codecs/smc.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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()?; -- 2.39.5