fix(interpreter): Stack push_slice fix and dup with pointers (#837)#837
fix(interpreter): Stack push_slice fix and dup with pointers (#837)#837rakita merged 2 commits intobluealloy:mainfrom
push_slice fix and dup with pointers (#837)#837Conversation
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 |
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_sliceto 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.