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
Considering that pub mod watchdog, pub struct OwnedDescriptor + pub atomic: *const AtomicU64,and confirm is also a pub function. I assume that users can directly call this function and control the atomic field. This potential situation could result in (*self.atomic) being operating on a null pointer, I suppose it might trigger undefined behavior (UB). For safety reasons, I felt it necessary to report this issue. If you have performed checks elsewhere that ensure this is safe, please don’t take offense at my raising this issue.
I suggest Several possible fixes:
If there is no external usage for OwnedDescriptor, it should not marked as pub at least its atomic field should not be pub.
confirm method should add additional check for invalid pointer.
mark confirm method as unsafe and proper doc to let users know that they should provide valid Pointers.
To reproduce
crate a OwnedDescriptor struct.
set the atomic field as null pointer.
call confirm method.
System info
I think it can happen in any platform.
The text was updated successfully, but these errors were encountered:
Describe the bug
Hello, thank you for your contribution in this project, I am scanning the unsoundness problem in rust project.
I notice the following code:
Considering that
pub mod watchdog
,pub struct OwnedDescriptor + pub atomic: *const AtomicU64
,andconfirm
is also a pub function. I assume that users can directly call this function and control theatomic
field. This potential situation could result in(*self.atomic)
being operating on a null pointer, I suppose it might trigger undefined behavior (UB). For safety reasons, I felt it necessary to report this issue. If you have performed checks elsewhere that ensure this is safe, please don’t take offense at my raising this issue.I suggest Several possible fixes:
OwnedDescriptor
, it should not marked aspub
at least itsatomic
field should not be pub.confirm
method should add additional check for invalid pointer.confirm
method as unsafe and proper doc to let users know that they should provide valid Pointers.To reproduce
System info
I think it can happen in any platform.
The text was updated successfully, but these errors were encountered: