-
Notifications
You must be signed in to change notification settings - Fork 46
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
Incorrect (and probably unsound) transmutes #40
Comments
niklasf
referenced
this issue
in niklasf/rust-cpuid
Jan 17, 2021
Add comments explaining why all safety requirements are now met.
Drafting a corresponding advisory here: rustsec/advisory-db#614. |
Many thanks for fixing this! |
This was referenced Jan 25, 2021
This was referenced Mar 8, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The code contains several transmutes similar to this:
Reading about transmutes in the nomicon, this is not correct, because the Rust compiler is free to reorder the fields of the struct.
It is also probably unsound, because I believe the Rust compiler is technically even free to add padding.
Adding
#[repr(C)]
may be a fix. However I am not sure what role endianness plays here (same question as #39).is a fix. I'll submit a pull request.The text was updated successfully, but these errors were encountered: