-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Hello, I found a soundness issue in this crate.
Lines 590 to 596 in 8afeeb1
| pub fn black_box<T>(dummy: T) -> T { | |
| unsafe { | |
| let ret = ptr::read_volatile(&dummy); | |
| forget(dummy); | |
| ret | |
| } | |
| } |
https://doc.rust-lang.org/std/ptr/fn.read_volatile.html
The unsafe function called needs to ensure that the parameter must be :
-
src must be valid for reads.
-
src must be properly aligned.
-
src must point to a properly initialized value of type T.
and the developer who calls the black_box function may not notice this safety requirement.
Marking them unsafe also means that callers must make sure they know what they're doing.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels