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

Heads-up: UB due to misuse of mem::uninitialized will soon lead to panic #2

Closed
RalfJung opened this issue Feb 16, 2020 · 3 comments · Fixed by #3
Closed

Heads-up: UB due to misuse of mem::uninitialized will soon lead to panic #2

RalfJung opened this issue Feb 16, 2020 · 3 comments · Fixed by #3

Comments

@RalfJung
Copy link

Here, this crate causes UB by "Producing an invalid value". Concretely, it creates an arbitrary T with mem::uninitialized(). In the near future the call to mem::uninitialized() will panic to avoid UB, and our crater run determined that this crate will be affected.

mem::uninitialized() is deprecated since Rust 1.39. The intended replacement is MaybeUninit, which tracks the possibility of uninitialized values at the type level to make sure the compiler does not make any false assumptions.

@calixteman
Copy link

@RalfJung, any chance to have a fix here ?

@RalfJung
Copy link
Author

RalfJung commented Oct 23, 2020

I'm not familiar with this library I am afraid. I am working on rustc and the library just showed up when we did our regression testing for this change. Cc rust-lang/rust#66151

The library does not seem maintained any more; I am not sure what would be good replacements.

@emilk
Copy link
Owner

emilk commented Oct 25, 2020

@ilaril made a beautiful fix, and I have released a 1.0.1

mitsuhiko added a commit to getsentry/symbolic that referenced this issue Nov 12, 2020
dmsort 1.0 misuses `mem::uninitialized` which is now leading to a panic
which causes problems for certain symbols.

Refs emilk/drop-merge-sort#2
mitsuhiko added a commit to getsentry/symbolic that referenced this issue Nov 12, 2020
dmsort 1.0 misuses `mem::uninitialized` which is now leading to a panic
which causes problems for certain symbols.

Refs emilk/drop-merge-sort#2
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.

3 participants