From 26fe67024711e11dc31501cb8adf0261bf372899 Mon Sep 17 00:00:00 2001 From: Sander Willems Date: Wed, 24 Jan 2024 16:54:48 +0100 Subject: [PATCH] FIX: Empty frames --- src/file_readers/common/ms_data_blobs.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/file_readers/common/ms_data_blobs.rs b/src/file_readers/common/ms_data_blobs.rs index 3f4b802..c261b9b 100644 --- a/src/file_readers/common/ms_data_blobs.rs +++ b/src/file_readers/common/ms_data_blobs.rs @@ -31,12 +31,14 @@ impl BinFileReader { &mmap[offset as usize..(offset + 4) as usize]; let byte_count: u32 = u32::from_le_bytes(raw_byte_count.try_into().unwrap()); - let compressed_blob: &[u8] = &mmap - [(offset + 8) as usize..offset as usize + byte_count as usize]; - let blob: Vec = decode_all(compressed_blob).unwrap(); - return blob; + if byte_count > 8 { + let compressed_blob: &[u8] = &mmap[(offset + 8) as usize + ..offset as usize + byte_count as usize]; + let blob: Vec = decode_all(compressed_blob).unwrap(); + return blob; + } }; - return vec![0]; + return vec![]; } pub fn size(&self) -> usize {