-
Notifications
You must be signed in to change notification settings - Fork 32
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 struct AVFrame {
/// Raw pointer on the AVFrame
pub ptr: *mut ffmpeg::AVFrame,
}
impl AVFrame {
...........................
pub fn plane(&mut self, indx: usize, len: usize) -> &mut [u8] {
unsafe {
let data_ptr = (*self.ptr).data[indx];
std::slice::from_raw_parts_mut(data_ptr, len)
}
}
}
Considering that pub mod ffmpeg_helper, ptr is a pub field, and plane is also a pub function. I assume that users can directly manipulate this field. This potential situation could result in *self.ptr being dereference 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