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
Currently, the code that reads from a given pointer in memory does not perform any check on the alignment of the pointer:
/// Reads the location pointed to by this `WasmRef`.
#[inline]
pub fn read(self) -> Result<T, MemoryAccessError> {
let mut out = MaybeUninit::uninit();
let buf =
unsafe { slice::from_raw_parts_mut(out.as_mut_ptr() as *mut u8, mem::size_of::<T>()) };
self.buffer.read(self.offset, buf)?;
Ok(unsafe { out.assume_init() })
}
This can cause panics. This part of the code should check if the pointer is aligned before creating the slice, and return an error in case it is not aligned.
The text was updated successfully, but these errors were encountered:
Currently, the code that reads from a given pointer in memory does not perform any check on the alignment of the pointer:
This can cause panics. This part of the code should check if the pointer is aligned before creating the slice, and return an error in case it is not aligned.
The text was updated successfully, but these errors were encountered: