]> git.nihav.org Git - nihav.git/commitdiff
truemotion1: always pad buffer for old versions of the format
authorKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 7 Apr 2025 16:39:35 +0000 (18:39 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 7 Apr 2025 16:41:04 +0000 (18:41 +0200)
Apparently it is not just the oldest version that may overread data.

nihav-duck/src/codecs/truemotion1.rs

index 591a4bc7865e98915069c3f96a9a454430687d1d..1eb880f315d53332ee4539887c203536894b97e7 100644 (file)
@@ -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 {