Skip to content

Commit

Permalink
Merge pull request ethereum#1896 from karalabe/fix-vm-stack-logs
Browse files Browse the repository at this point in the history
core/vm: copy stack element to prevent overwrites
  • Loading branch information
obscuren committed Oct 12, 2015
2 parents 315a422 + af9afb6 commit 0de9b16
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,17 +370,18 @@ 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)
object.EachStorage(func(k, v []byte) {
storage[common.BytesToHash(k)] = v
})
*/

self.env.AddStructLog(StructLog{pc, op, new(big.Int).Set(gas), cost, mem, stck, storage, err})
}
}
Expand Down

0 comments on commit 0de9b16

Please sign in to comment.