Closed kuzeyardabulut closed 11 months ago
It is impossible to get data races in Handle
struct, because its fields are just both u32
which both Send
+ Sync
. This unsafe impl is needed just to implement Send
+ Sync
for PhantomData<T>
. Any objections?
Hi, I found a memory-safety/soundness issue in this crate while scanning Rust code for potential vulnerabilities. This PR contains a fix for the issue.
Issue Description
Handle<T>
unconditionally implements Sync. This allows users to create data races onT: !Sync
. Such data races can lead to undefined behavior. https://github.com/FyroxEngine/Fyrox/blob/7f914495a85f95f9dc244c829be3ed94b2c8c098/fyrox-core/src/pool.rs#L203-L204This may not cause a direct data race. But making changes can be useful.