Skip to content
Snippets Groups Projects
Verified Commit 24d3e02c authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

chore: better crc32 unpack

parent ed2ed6be
No related branches found
No related tags found
No related merge requests found
Pipeline #4860 failed
......@@ -215,7 +215,11 @@ impl Zippy {
#[inline(always)]
fn read_crc32_feature(&mut self, data: &mut Cursor<&[u8]>) -> Result<(), Error> {
let payload: [u8; 4] = Self::read_payload(data)?.try_into().unwrap();
let payload = Self::read_payload(data)?;
if payload.len() != size_of::<u32>() {
return Err(Error::InvalidData);
}
let payload: [u8; 4] = payload.try_into().unwrap();
self.crc32 = u32::from_le_bytes(payload);
Ok(())
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment