-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
hello, thank you for your contribution in this project, I am scanning the unsoundness problem in rust project.
I notice the following code:
pub fn add_ref(&self) -> std::os::raw::c_long {
unsafe {
let this = self as *const IObjectArray as *const *const std::os::raw::c_void;
let ret = ((*self.vtable).add_ref)(this);
let ret: std::os::raw::c_long = ret.into();
ret
}
}
Considering that vtable is a pub field, I assume that users can directly manipulate this field, and that add_ref is a public function. This potential situation could result in self.vtable being a null pointer, and directly dereferencing 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.
Metadata
Metadata
Assignees
Labels
No labels