-
Notifications
You must be signed in to change notification settings - Fork 644
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
fix(interpreter): Stack push_slice
fix and dup with pointers (#837)
#837
Conversation
The pointer would have the same |
No because
|
That seems like a false positive, reference is just a sugar here. It seems that So just moving |
It's still uninitialized memory, so a reference to that is always undefined behavior. It's not a false positive. Moving "it works" because we have checked the bounds of the stack allocation and it happens that the implementation detail for |
You are right, uninit memory should be dealt with, I have spent a lot of time in cpp land so this doesn't trigger me. Uninit can be a big problem and UB when you have a type that does the Drop or possibly the padding, for U256 this is not the case so it is considered safe here and not a UB. Good read here for exactly this: rust-lang/rust-clippy#4483 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
push_slice
implpush_slice
fix and dup with pointers (#837)
get_unchecked{,_mut}
is always UB if out of bounds. This is easy to overlook because it works correctly, but it's still UB. Use pointers instead.Stack::push_slice
(refactor: rewriteStack::push_slice
to allow arbitrary lengths #812) did not handle more than one word (32 bytes) correctly. Added simple unit tests to verify correct behavior. No performance changes.