From a1f7d4420b21eb88a9653cd41ce29f46484e2fdf Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Mon, 7 Apr 2025 18:39:35 +0200 Subject: [PATCH] truemotion1: always pad buffer for old versions of the format Apparently it is not just the oldest version that may overread data. --- nihav-duck/src/codecs/truemotion1.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nihav-duck/src/codecs/truemotion1.rs b/nihav-duck/src/codecs/truemotion1.rs index 591a4bc..1eb880f 100644 --- a/nihav-duck/src/codecs/truemotion1.rs +++ b/nihav-duck/src/codecs/truemotion1.rs @@ -606,11 +606,12 @@ impl NADecoder for TM1Decoder { let mut index = IndexState::new(index_bytes); index.tbl0 = vec_idx == 0; let mut padded_idx_bytes = Vec::new(); - if index.tbl0 { // old format, use padded buffer as the source instead + if index.tbl0 || version == 1 || (version == 2 && meta_type == 1) { + // old format, use padded buffer as the source instead padded_idx_bytes.extend_from_slice(index_bytes); padded_idx_bytes.resize(index_bytes.len() + 4, 0); index = IndexState::new(&padded_idx_bytes); - index.tbl0 = true; + index.tbl0 = vec_idx == 0; } let bufinfo; if !is_24bit { -- 2.39.5