-
Notifications
You must be signed in to change notification settings - Fork 0
Heads-up: UB due to misuse of mem::zeroed will soon lead to panic #1
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
Comments
And, sure enough, almost two years later, running the example from the documentation:
|
And the crate now fails its own tests:
|
Thanks for the reminder @John-Nagle, time got away from me. Fixed in most recent comment -> 8fe6506 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here, this crate causes UB by "Producing an invalid value". Concretely, it creates an arbitrary
T
withmem::zeroed()
. In the near future the call tomem::zeroed()
will panic to avoid UB, and our crater run determined that this crate will be affected. (Specifically, the test suite of this crate creates a zero-initializedString
, which is invalid.)Maybe a good 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.The text was updated successfully, but these errors were encountered: