Browse Source

vm: fix errors not being returned

pull/46/head
Ethan Buchman 10 years ago
parent
commit
ade13daec1
2 changed files with 4 additions and 4 deletions
  1. +3
    -3
      vm/stack.go
  2. +1
    -1
      vm/vm.go

+ 3
- 3
vm/stack.go View File

@ -32,9 +32,9 @@ func (st *Stack) useGas(gasToUse uint64) {
} }
func (st *Stack) setErr(err error) { 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) { func (st *Stack) Push(d Word256) {


+ 1
- 1
vm/vm.go View File

@ -659,7 +659,7 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value uint64, ga
case RETURN: // 0xF3 case RETURN: // 0xF3
offset, size := stack.Pop64(), stack.Pop64() offset, size := stack.Pop64(), stack.Pop64()
ret, ok := subslice(memory, offset, size, false) ret, ok := subslice(memory, offset, size, false)
if !ok {
if !ok || err != nil {
return nil, firstErr(err, ErrMemoryOutOfBounds) return nil, firstErr(err, ErrMemoryOutOfBounds)
} }
dbg.Printf(" => [%v, %v] (%d) 0x%X\n", offset, size, len(ret), ret) dbg.Printf(" => [%v, %v] (%d) 0x%X\n", offset, size, len(ret), ret)


Loading…
Cancel
Save