You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, we (Rust group @sslab-gatech) are scanning crates on crates.io for potential soundness bugs. We noticed that some soundness issues in the Ptr class.
Ptr implements the Send and Sync traits for all types:
This allows you to send types that aren't safe to use across threads like Rc and Cell. We'd recommend only implementing this when the T: Send and T: Sync.
Ptr violates aliasing rules by having .get() take a reference and return a mutable reference.
Once a fix is released to crates.io, please open a pull request to update the advisory with the patched version, or file an issue on the advisory database repository.
Hi there, we (Rust group @sslab-gatech) are scanning crates on crates.io for potential soundness bugs. We noticed that some soundness issues in the
Ptr
class.Ptr
implements theSend
andSync
traits for all types:cgc/src/mem.rs
Lines 829 to 830 in e8e277f
This allows you to send types that aren't safe to use across threads like
Rc
andCell
. We'd recommend only implementing this when theT: Send
andT: Sync
.Ptr
violates aliasing rules by having.get()
take a reference and return a mutable reference.cgc/src/mem.rs
Lines 760 to 764 in e8e277f
This allows you to create multiple mutable references to the same object which is undefined behavior in Rust.
Ptr::write
writes to the raw pointer underneath:cgc/src/mem.rs
Lines 775 to 777 in e8e277f
This can lead to data-races, using an atomic pointer would be better if you want to support multiple threads.
Here's a proof-of-concept for the two of the issues above:
This outputs:
The text was updated successfully, but these errors were encountered: