zenoh icon indicating copy to clipboard operation
zenoh copied to clipboard

[Bug] Undefined Behavior in `zenoh_config::Notifier`

Open jhdcs opened this issue 2 years ago • 0 comments

Describe the bug

The function mutable found on https://github.com/eclipse-zenoh/zenoh/blob/45b7ad70bddf45dfcdcae80e9c9a7680c70ac289/commons/zenoh-config/src/lib.rs#L500 transmutes a reference to a mutable reference, which is defined in the Rust language documentation as always being Undefined Behavior (since it breaks LLVM's pointer aliasing rules).

Is it possible to refactor the code to use an UnsafeCell instead?

To reproduce

N/A - found via looking through code

System info

Zenoh Commit: 45b7ad70bddf45dfcdcae80e9c9a7680c70ac289

jhdcs avatar Sep 08 '22 15:09 jhdcs