Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zero on crates.io seems outdated #9

Closed
whfuyn opened this issue Nov 26, 2022 · 1 comment
Closed

zero on crates.io seems outdated #9

whfuyn opened this issue Nov 26, 2022 · 1 comment

Comments

@whfuyn
Copy link

whfuyn commented Nov 26, 2022

https://docs.rs/crate/zero/0.1.2/source/src/lib.rs

It doesn't check the alignment as it is on GitHub:

zero/src/lib.rs

Lines 51 to 59 in 4a72475

pub fn read_array<T: Pod>(input: &[u8]) -> &[T] {
let t_size = mem::size_of::<T>();
assert!(t_size > 0, "Can't read arrays of zero-sized types");
assert!(input.len() % t_size == 0);
let addr = input.as_ptr() as usize;
assert!(addr & (mem::align_of::<T>() - 1) == 0);
unsafe { read_array_unsafe(input) }
}

Maybe publish a new version?

@nrc
Copy link
Owner

nrc commented Nov 27, 2022

I've published a new version 0.1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants