-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple Unsoundness issue #25
Comments
same for *(&bytes[offset..(offset + 2)] as *const [u8] as *const [u8; 2]) The issue is in the read_u16 function where it unsafely accesses memory:
There's no bounds checking to ensure that offset + 2 is within the bounds of the bytes slice before performing the unsafe operation. In new_compiled, it makes multiple calls to read_u16 with various offsets without validating the input slice has sufficient length. Poc
|
same for NoProto/no_proto_js/src/rpc.rs Line 417 in 827ebb9
there is no check for valid utf8 bytes. valid path: pub fn new_compiled -> fn read_str |
also path from pub fn open_request -> fn read_u16 |
same for |
Hello, thank you for your contribution in this project, I an testing our static analysis tool in github's Rust project and I notice the following code:
NoProto/no_proto_js/src/hashmap.rs
Line 127 in 827ebb9
The issue is in get_32_block where it unsafely transmutes a byte slice to a u32 slice:
rustCopylet b32: &[u32] = unsafe { core::mem::transmute(bytes) };
This transmute assumes that bytes is properly aligned for u32 (4-byte alignment), but the public function murmurhash3_x86_32 does not validate this alignment requirement. When calling the function with an unaligned byte slice, it causes undefined behavior when accessing the transmuted u32 values. Although it is a private function, I notice a possible way to call this function from a pub function
murmurhash3_x86_32
.POC
The text was updated successfully, but these errors were encountered: