This repository has been archived by the owner on May 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Illegal use of mem::zeroed() #18
Comments
Heads-up: with rust-lang/rust#66059, this will turn into a panic to protect people from UB. The crater log indicates that the type you are zero-initializing here is Cc @JakubOnderka, maintainer of ip_network_table, which according to crater will also be affected when the UB here turns into a panic. |
JakubOnderka
added a commit
to JakubOnderka/treebitmap
that referenced
this issue
Feb 22, 2020
JakubOnderka
added a commit
to JakubOnderka/treebitmap
that referenced
this issue
Feb 22, 2020
This issue is resolved right? It's still open cc @JakubOnderka , @hroi |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The use of
mem::zeroed
attreebitmap/src/tree_bitmap/allocator.rs
Line 195 in 9540ae5
mem::zeroed
may only be used for types that actually allow zero-initialization, and here this is done for any user-controlled typeT
. So, e.g. ifT
is a reference, this is UB as references must not be all-zero.If you just want to write a bunch of zero bytes to memory, I suggest using
write_bytes
.The text was updated successfully, but these errors were encountered: