clippy: fix access to unaligned buffer in dynamic reader

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-09-11 14:50:45 +02:00
parent b526bd1408
commit ba5e67475a
1 changed files with 1 additions and 3 deletions

View File

@ -80,9 +80,7 @@ impl DynamicIndexReader {
let header_size = std::mem::size_of::<DynamicIndexHeader>(); let header_size = std::mem::size_of::<DynamicIndexHeader>();
let buffer = file.read_exact_allocated(header_size)?; let header: Box<DynamicIndexHeader> = unsafe { file.read_host_value_boxed()? };
let header = unsafe { &* (buffer.as_ptr() as *const DynamicIndexHeader) };
if header.magic != super::DYNAMIC_SIZED_CHUNK_INDEX_1_0 { if header.magic != super::DYNAMIC_SIZED_CHUNK_INDEX_1_0 {
bail!("got unknown magic number"); bail!("got unknown magic number");