From: Kostya Shishkov Date: Mon, 7 Apr 2025 16:39:35 +0000 (+0200) Subject: truemotion1: always pad buffer for old versions of the format X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=a1f7d4420b21eb88a9653cd41ce29f46484e2fdf;p=nihav.git truemotion1: always pad buffer for old versions of the format Apparently it is not just the oldest version that may overread data. --- 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 {