mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-20 16:36:31 +00:00
vm: catch stack underflow on Peek()
This commit is contained in:
@ -104,6 +104,10 @@ func (st *Stack) Dup(n int) {
|
|||||||
|
|
||||||
// Not an opcode, costs no gas.
|
// Not an opcode, costs no gas.
|
||||||
func (st *Stack) Peek() Word256 {
|
func (st *Stack) Peek() Word256 {
|
||||||
|
if st.ptr == 0 {
|
||||||
|
st.setErr(ErrDataStackUnderflow)
|
||||||
|
return Zero256
|
||||||
|
}
|
||||||
return st.data[st.ptr-1]
|
return st.data[st.ptr-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user