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

users potential unaligned read #1731

Closed
dtolnay opened this issue Jul 24, 2023 · 0 comments · Fixed by #1776
Closed

users potential unaligned read #1731

dtolnay opened this issue Jul 24, 2023 · 0 comments · Fixed by #1776

Comments

@dtolnay
Copy link
Contributor

dtolnay commented Jul 24, 2023

The users crate (in addition to being unmaintained for 3 years) contains this unsoundness: ogham/rust-users#55.

In some build modes, this is observable as a panic followed by abort:

thread 'main' panicked at 'misaligned pointer dereference: address must be a multiple of 0x8 but is 0x14480860b', /Users/dhruvkb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/users-0.11.0/src/base.rs:297:34
thread 'main' panicked at 'panic in a function that cannot unwind', library/core/src/panicking.rs:126:5
thread caused non-unwinding panic. aborting.

In other build modes the UB may manifest in some other way, including the possibility of "working correctly" in some architectures. With RFC 3204 "Alignment niches for references types" and other compiler work, even the currently "working correctly" cases may deteriorate over time.

The affected code are the two *username here: https://github.com/ogham/rust-users/blob/d6883b4cc1bf00fdca920f5064ea551684fc0faf/src/base.rs#L297-L301.

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

Successfully merging a pull request may close this issue.

1 participant