-
Notifications
You must be signed in to change notification settings - Fork 59
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
Misaligned pointer dereference in chunk_entries_at
and transmute_chunk
#223
Comments
Thanks for the report
Here the This one looks technically unsound ineed since |
I don't think this is a security issue. It's more about formal source code correctness. The compiler still generates correct machine code here and I can't think of a way to exploit this. I guess it is technically an unsoundness, but not the one exposed in the API and not the one causing any real issues. |
Yes. @arkpar , that's the unsoundness issue from the perspective of Rust's language model. That's what RUSTSEC collects for unsoundness issues. |
@arkpar just for discussion, unaligned access could lead to runtime panic depends on the target machine. Isn't that kind of security issue leading to Denial of Service? 🤔️ At least runtime panic could crash the program. |
Sure it can, but I'm arguing that unaligned access can't happen here in practice. In paractice the compiler generates code that passes the pointer without moving the data to the stack and that pointer is guaranteed to a be aligned. I don't think anyone can write an actual program for any supported platform using this crate, that can panic because of this issue. But I'd be happy to be proven wrong if you can demonstrate it. |
The source of unsoundness
Hi, we consider that the following two functions could have misaligned pointer dereference and lead to UB:
parity-db/src/index.rs
Lines 255 to 258 in 4ac2aca
At line 258 of
chunk_entries_at
,parity-db/src/index.rs
Lines 418 to 422 in 4ac2aca
and at line 419 of
transmute_chunk
,they both tried to convert the type aligned to 1 byte to the type aligned to 8 bytes. Please check and would be happy to have any discussion:)
The text was updated successfully, but these errors were encountered: