Skip to content

Commit

Permalink
Replace unaligned pointer deref with read_unaligned
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Jan 31, 2022
1 parent 14cd007 commit 4e35909
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ macro_rules! impl_fixedint {
}
fn decode_fixed(src: &[u8]) -> $t {
assert_eq!(src.len(), Self::REQUIRED_SPACE);
return unsafe { *(src.as_ptr() as *const $t) };
return unsafe { (src.as_ptr() as *const $t).read_unaligned() };
}
}
};
Expand Down

0 comments on commit 4e35909

Please sign in to comment.