treebitmap
treebitmap copied to clipboard
Illegal use of mem::zeroed()
The use of mem::zeroed at https://github.com/hroi/treebitmap/blob/9540ae5e84d3f5123306588af45d0bd71f22cc44/src/tree_bitmap/allocator.rs#L195 looks illegal: mem::zeroed may only be used for types that actually allow zero-initialization, and here this is done for any user-controlled type T. So, e.g. if T 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.
Heads-up: with https://github.com/rust-lang/rust/pull/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 &str -- references must indeed never be null.
Cc @JakubOnderka, maintainer of ip_network_table, which according to crater will also be affected when the UB here turns into a panic.
This issue is resolved right? It's still open
cc @JakubOnderka , @hroi