diff options
Diffstat (limited to 'vm')
-rw-r--r-- | vm/closure.go | 2 | ||||
-rw-r--r-- | vm/vm_debug.go | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/vm/closure.go b/vm/closure.go index ef9bbca93..5bd8c1bb8 100644 --- a/vm/closure.go +++ b/vm/closure.go @@ -64,7 +64,7 @@ func (c *Closure) GetOp(x int) OpCode { } func (c *Closure) GetByte(x int) byte { - if x < len(c.Code) { + if x > -1 && x < len(c.Code) { return c.Code[x] } diff --git a/vm/vm_debug.go b/vm/vm_debug.go index b9c1d4bc6..4daa3ab5b 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -277,7 +277,6 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) { addStepGasUsage(memGasUsage) - mem.Resize(newMemSize.Uint64()) } } @@ -295,6 +294,8 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) { return closure.Return(nil), OOG(gas, tmp) } + mem.Resize(newMemSize.Uint64()) + switch op { // 0x20 range case ADD: |