From 5c8c0ae04e83389e3b97c527c11c819f219e344d Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 9 Jan 2015 15:30:46 +0100 Subject: [PATCH] Fixed size 0 bug --- vm/stack.go | 4 ++++ vm/vm_debug.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/vm/stack.go b/vm/stack.go index b9eaa10cd4..f20470db36 100644 --- a/vm/stack.go +++ b/vm/stack.go @@ -152,6 +152,10 @@ func (m *Memory) Get(offset, size int64) []byte { } func (self *Memory) Geti(offset, size int64) (cpy []byte) { + if size == 0 { + return nil + } + if len(self.store) > int(offset) { cpy = make([]byte, size) copy(cpy, self.store[offset:offset+size]) diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 92e4154e4f..656487c9b9 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -34,7 +34,7 @@ func NewDebugVm(env Environment) *DebugVm { lt = LogTyDiff } - return &DebugVm{env: env, logTy: lt, Recoverable: true} + return &DebugVm{env: env, logTy: lt, Recoverable: false} } func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price *big.Int, callData []byte) (ret []byte, err error) {