Hi, I am scanning the memx in the latest version with my own static analyzer tool.
Unsafe conversion found at: src/mem/mem_set.rs#L404
#[inline(always)]
fn _set_c16_uu_x1(buf_ptr: *mut u8, c16: B16Sgl) {
let aa_ptr = buf_ptr as *mut u128;
unsafe { aa_ptr.write_unaligned(c16.v1) };
}
This unsound implementation would create a misalignment issues if the type size of u8 is smaller than the type size of u128. write_unaligned is not a good function, at least _set_c16_uu_x1 should be annoated with unsafe.
This would potentially cause undefined behaviors in Rust. If we further manipulate the problematic converted types, it would potentially lead to different consequences such as access out-of-bound. I am reporting this issue for your attention.
Hi, I am scanning the memx in the latest version with my own static analyzer tool.
Unsafe conversion found at: src/mem/mem_set.rs#L404
This unsound implementation would create a misalignment issues if the type size of
u8
is smaller than the type size ofu128
.write_unaligned
is not a good function, at least _set_c16_uu_x1 should be annoated with unsafe.This would potentially cause undefined behaviors in Rust. If we further manipulate the problematic converted types, it would potentially lead to different consequences such as access out-of-bound. I am reporting this issue for your attention.