From af9afb686bbfcbb57fad80511983d155b26a4460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 12 Oct 2015 00:14:35 +0300 Subject: [PATCH] core/vm: copy stack element to prevent overwrites --- core/vm/vm.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/vm/vm.go b/core/vm/vm.go index 57dd4dac3..4b03e55f0 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -370,9 +370,11 @@ func (self *Vm) log(pc uint64, op OpCode, gas, cost *big.Int, memory *Memory, st if Debug { mem := make([]byte, len(memory.Data())) copy(mem, memory.Data()) - stck := make([]*big.Int, len(stack.Data())) - copy(stck, stack.Data()) + stck := make([]*big.Int, len(stack.Data())) + for i, item := range stack.Data() { + stck[i] = new(big.Int).Set(item) + } storage := make(map[common.Hash][]byte) /* object := contract.self.(*state.StateObject) @@ -380,7 +382,6 @@ func (self *Vm) log(pc uint64, op OpCode, gas, cost *big.Int, memory *Memory, st storage[common.BytesToHash(k)] = v }) */ - self.env.AddStructLog(StructLog{pc, op, new(big.Int).Set(gas), cost, mem, stck, storage, err}) } }