avi: fix handling of palette change chunk with 256 colours
authorKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 14 Feb 2023 17:50:51 +0000 (18:50 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 14 Feb 2023 17:50:51 +0000 (18:50 +0100)
nihav-commonfmt/src/demuxers/avi.rs

index 0ab7711d089381abe992b91a9978d3c5592b9d98..f14c31a466042ae15fe2e969dfbfa722ea719fb9 100644 (file)
@@ -429,6 +429,7 @@ impl<'a> AVIDemuxer<'a> {
             if pe.stream_no == stream_no {
                 let start_clr           = self.src.read_byte()? as usize;
                 let len                 = self.src.read_byte()? as usize;
+                let len = if len == 0 { 256 } else { len };
                 let _flags              = self.src.read_u16le()?;
                 validate!(start_clr + len <= 256);
                 validate!(len * 4 + 4 == size);