From ade13daec1f14603c65d938471b9480f05f81cf6 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 2 Apr 2015 19:14:58 -0700 Subject: [PATCH] vm: fix errors not being returned --- vm/stack.go | 6 +++--- vm/vm.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vm/stack.go b/vm/stack.go index 6b74643ac..7219051fd 100644 --- a/vm/stack.go +++ b/vm/stack.go @@ -32,9 +32,9 @@ func (st *Stack) useGas(gasToUse uint64) { } func (st *Stack) setErr(err error) { - if *st.err != nil { - *st.err = err - } + //if *st.err != nil { + *st.err = err + //} } func (st *Stack) Push(d Word256) { diff --git a/vm/vm.go b/vm/vm.go index cbf68729d..e21a914f8 100644 --- a/vm/vm.go +++ b/vm/vm.go @@ -659,7 +659,7 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value uint64, ga case RETURN: // 0xF3 offset, size := stack.Pop64(), stack.Pop64() ret, ok := subslice(memory, offset, size, false) - if !ok { + if !ok || err != nil { return nil, firstErr(err, ErrMemoryOutOfBounds) } dbg.Printf(" => [%v, %v] (%d) 0x%X\n", offset, size, len(ret), ret)