diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-12 20:32:45 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-12 20:32:45 +0800 |
commit | 0de9b16b118cc1c12689b96fdded22f8a42f71f4 (patch) | |
tree | 5b7960c066ba347455efa1b48f621af53c00ac81 | |
parent | 315a422ba754eae10db21990a809f608f7af62d4 (diff) | |
parent | af9afb686bbfcbb57fad80511983d155b26a4460 (diff) | |
download | go-tangerine-0de9b16b118cc1c12689b96fdded22f8a42f71f4.tar go-tangerine-0de9b16b118cc1c12689b96fdded22f8a42f71f4.tar.gz go-tangerine-0de9b16b118cc1c12689b96fdded22f8a42f71f4.tar.bz2 go-tangerine-0de9b16b118cc1c12689b96fdded22f8a42f71f4.tar.lz go-tangerine-0de9b16b118cc1c12689b96fdded22f8a42f71f4.tar.xz go-tangerine-0de9b16b118cc1c12689b96fdded22f8a42f71f4.tar.zst go-tangerine-0de9b16b118cc1c12689b96fdded22f8a42f71f4.zip |
Merge pull request #1896 from karalabe/fix-vm-stack-logs
core/vm: copy stack element to prevent overwrites
-rw-r--r-- | core/vm/vm.go | 7 |
1 files 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}) } } |