-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Maybe unsound in CodeAttribute #2
Comments
ping |
Hi, I'll look into that. But this is my old codebase, so don't expect much of further information. |
Ok, thanks for your reply! I just want to comfirm whether this pattern is unsound. |
From your explanation, I think the pattern is unsound. It'd be better if you could explain the definition unsoundness though. |
Of course, thanks for your reply! Here is the definition of soundness in Rust: Accordingly, we say that a library (or an individual function) is sound if it is impossible for safe code to cause Undefined Behavior using its public API. Conversely, the library/function is unsound if safe code can cause Undefined Behavior. |
Well, then my code here is unsound :) |
hello, thank you for your contribution in this project, I am scanning the unsoundness problem in rust project.
I notice the following code:
Considering that
pub mod class
,code
is apub
field, andread_u16_from_code
read_u8_from_code
........ are also pub function. I assume that users can directly manipulate this field. This potential situation could result in*self.code
being dereference a null pointer, and directly dereferencing it might trigger undefined behavior (UB). For safety reasons, I felt it necessary to report this issue. If you have performed checks elsewhere that ensure this is safe, please don’t take offense at my raising this issue.If there is no external usage for
CodeAttribute
, I suggest it should not marked aspub
, at least its field should not marked aspub
.The text was updated successfully, but these errors were encountered: