mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-17 05:26:36 +00:00
Merge pull request #60 from shemnon/eof/extcodecopy-oob
Limit EXTCODECOPY to eof bytes
This commit is contained in:
commit
f0dc433e31
1 changed files with 4 additions and 2 deletions
|
|
@ -395,6 +395,7 @@ func opExtCodeCopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext)
|
||||||
codeOffset = stack.pop()
|
codeOffset = stack.pop()
|
||||||
length = stack.pop()
|
length = stack.pop()
|
||||||
lengthU64 = length.Uint64()
|
lengthU64 = length.Uint64()
|
||||||
|
codeCopy []byte
|
||||||
)
|
)
|
||||||
uint64CodeOffset, overflow := codeOffset.Uint64WithOverflow()
|
uint64CodeOffset, overflow := codeOffset.Uint64WithOverflow()
|
||||||
if overflow {
|
if overflow {
|
||||||
|
|
@ -406,9 +407,10 @@ func opExtCodeCopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext)
|
||||||
witness.AddCode(code)
|
witness.AddCode(code)
|
||||||
}
|
}
|
||||||
if isEOFVersion1(code) {
|
if isEOFVersion1(code) {
|
||||||
lengthU64 = 2
|
codeCopy = getData(eofMagic, uint64CodeOffset, lengthU64)
|
||||||
|
} else {
|
||||||
|
codeCopy = getData(code, uint64CodeOffset, lengthU64)
|
||||||
}
|
}
|
||||||
codeCopy := getData(code, uint64CodeOffset, lengthU64)
|
|
||||||
scope.Memory.Set(memOffset.Uint64(), lengthU64, codeCopy)
|
scope.Memory.Set(memOffset.Uint64(), lengthU64, codeCopy)
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue