From 2954519d5e82d469d06c1adbcc9d3d8faad81aac Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 28 Jul 2022 18:42:50 +0200 Subject: [PATCH] vp8: use safer initialisation of partition BoolCoders --- nihav-duck/src/codecs/vp8.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/nihav-duck/src/codecs/vp8.rs b/nihav-duck/src/codecs/vp8.rs index 9a9c4cc..de5d32a 100644 --- a/nihav-duck/src/codecs/vp8.rs +++ b/nihav-duck/src/codecs/vp8.rs @@ -1281,13 +1281,10 @@ impl NADecoder for VP8Decoder { for start in part_offs[num_partitions..].iter_mut() { *start = data_start; } - let mut bc_src = unsafe { - let mut arr: [BoolCoder; 8] = std::mem::MaybeUninit::uninit().assume_init(); - for (bc, &off) in arr.iter_mut().zip(part_offs.iter()) { - std::ptr::write(bc, BoolCoder::new(&src[off..]).unwrap()); - } - arr - }; + let mut bc_src = Vec::new(); + for &off in part_offs.iter() { + bc_src.push(BoolCoder::new(&src[off..]).unwrap()); + } let vinfo = NAVideoInfo::new(self.width, self.height, false, YUV420_FORMAT); let ret = supp.pool_u8.get_free(); -- 2.39.5