diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-19 21:31:14 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-19 21:31:14 +0800 |
commit | cf45b939a098c9421092226d5c76dbce34eb2dda (patch) | |
tree | 2a57c4880feff1f0ff98ec505998dbb1643db1b0 /vm/vm.go | |
parent | d7ab716eea1d1892e3358b1dece6b0e2cd31fce8 (diff) | |
download | dexon-cf45b939a098c9421092226d5c76dbce34eb2dda.tar.gz dexon-cf45b939a098c9421092226d5c76dbce34eb2dda.tar.zst dexon-cf45b939a098c9421092226d5c76dbce34eb2dda.zip |
fixed tests
Diffstat (limited to 'vm/vm.go')
-rw-r--r-- | vm/vm.go | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -443,24 +443,15 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) { self.Printf(" => %d", l) case CALLDATACOPY: var ( - size = uint64(len(callData)) mOff = stack.pop().Uint64() cOff = stack.pop().Uint64() l = stack.pop().Uint64() ) + data := getData(callData, cOff, l) - if cOff > size { - cOff = 0 - l = 0 - } else if cOff+l > size { - l = 0 - } - - code := callData[cOff : cOff+l] - - mem.Set(mOff, l, code) + mem.Set(mOff, l, data) - self.Printf(" => [%v, %v, %v] %x", mOff, cOff, l, callData[cOff:cOff+l]) + self.Printf(" => [%v, %v, %v] %x", mOff, cOff, l, data) case CODESIZE, EXTCODESIZE: var code []byte if op == EXTCODESIZE { @@ -487,7 +478,7 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) { cOff = stack.pop().Uint64() l = stack.pop().Uint64() ) - codeCopy := getCode(code, cOff, l) + codeCopy := getData(code, cOff, l) mem.Set(mOff, l, codeCopy) |