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
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 new(bytes: *const [u8]) -> Result<Elf<'a>, ElfError> {
let bytes = unsafe { &*bytes };
for i in 0..100 {
dprint!("{} ", bytes[i]);
if i % 10 == 9 {
dprintln!();
}
}
let elf = unsafe {
let data: *const ElfHeader = bytes.as_ptr() as *const ElfHeader;
&*(data)
};
dprintln!("{:?}", elf);
if elf.magic != ELF_MAGIC {
return Err(ElfError::InvalidMagic);
}
Ok(Elf { bytes, elf })
}
I think there may exist a unsound problem in this function. there is no test for the bytes, if the user pass a null pointer to this function it will lead to UB.
The text was updated successfully, but these errors were encountered:
Hello, thank you for your contribution in this project, I am scanning the unsoundness problem in rust project.
I notice the following code:
I think there may exist a unsound problem in this function. there is no test for the
bytes
, if the user pass a null pointer to this function it will lead to UB.The text was updated successfully, but these errors were encountered: