mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-09 14:43:19 +00:00
vm: check errors early to avoid infinite loop
This commit is contained in:
9
vm/vm.go
9
vm/vm.go
@@ -83,6 +83,11 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value uint64, ga
|
||||
)
|
||||
|
||||
for {
|
||||
// If there is an error, return
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var op = codeGetOp(code, pc)
|
||||
fmt.Printf("(pc) %-3d (op) %-14s (st) %-4d ", pc, op.String(), stack.Len())
|
||||
|
||||
@@ -652,10 +657,6 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value uint64, ga
|
||||
|
||||
pc++
|
||||
|
||||
// If there is an error, return
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user