diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-19 22:06:56 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-19 22:06:56 +0800 |
commit | a756dbeb7b1027eb91130ecf8d5440dca8e738d8 (patch) | |
tree | 594eba51f72759d9339ca6ef4d0d1537daf51696 | |
parent | cf45b939a098c9421092226d5c76dbce34eb2dda (diff) | |
download | dexon-a756dbeb7b1027eb91130ecf8d5440dca8e738d8.tar dexon-a756dbeb7b1027eb91130ecf8d5440dca8e738d8.tar.gz dexon-a756dbeb7b1027eb91130ecf8d5440dca8e738d8.tar.bz2 dexon-a756dbeb7b1027eb91130ecf8d5440dca8e738d8.tar.lz dexon-a756dbeb7b1027eb91130ecf8d5440dca8e738d8.tar.xz dexon-a756dbeb7b1027eb91130ecf8d5440dca8e738d8.tar.zst dexon-a756dbeb7b1027eb91130ecf8d5440dca8e738d8.zip |
Removed uint casts
-rw-r--r-- | vm/vm.go | 28 |
1 files changed, 18 insertions, 10 deletions
@@ -443,13 +443,16 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) { self.Printf(" => %d", l) case CALLDATACOPY: var ( - mOff = stack.pop().Uint64() - cOff = stack.pop().Uint64() - l = stack.pop().Uint64() + mOff = stack.pop() + cOff = stack.pop() + l = stack.pop() ) - data := getData(callData, cOff, l) + var data []byte + if cOff.Cmp(big.NewInt(int64(len(callData)))) <= 0 { + data = getData(callData, cOff.Uint64(), l.Uint64()) + } - mem.Set(mOff, l, data) + mem.Set(mOff.Uint64(), l.Uint64(), data) self.Printf(" => [%v, %v, %v] %x", mOff, cOff, l, data) case CODESIZE, EXTCODESIZE: @@ -473,14 +476,19 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) { } else { code = context.Code } + var ( - mOff = stack.pop().Uint64() - cOff = stack.pop().Uint64() - l = stack.pop().Uint64() + mOff = stack.pop() + cOff = stack.pop() + l = stack.pop() ) - codeCopy := getData(code, cOff, l) - mem.Set(mOff, l, codeCopy) + var codeCopy []byte + if cOff.Cmp(big.NewInt(int64(len(code)))) <= 0 { + codeCopy = getData(code, cOff.Uint64(), l.Uint64()) + } + + mem.Set(mOff.Uint64(), l.Uint64(), codeCopy) self.Printf(" => [%v, %v, %v] %x", mOff, cOff, l, codeCopy) case GASPRICE: |