mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
Apply new container mode validations
Apply new rules prohibiting STOP/RETURN in initcode and RETURNCONTRACT in runtime mode. For fuzzing, consider all input data to be runtime code.
This commit is contained in:
parent
28db438a8e
commit
9edd35cefe
2 changed files with 4 additions and 1 deletions
|
|
@ -338,7 +338,7 @@ func (c *Container) validateSubContainer(jt *JumpTable, isInitCode bool, refBy i
|
|||
code = c.Code[index]
|
||||
)
|
||||
if _, ok := visited[index]; !ok {
|
||||
res, err := validateCode(code, index, c, jt, isInitCode)
|
||||
res, err := validateCode(code, index, c, jt, isInitCode || refBy == RefByEOFCreate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,9 @@ func validateCode(code []byte, section int, container *Container, jt *JumpTable,
|
|||
return nil, fmt.Errorf("%w: arg %d, last %d, pos %d", ErrInvalidDataloadNArgument, arg, len(container.Data), i)
|
||||
}
|
||||
case op == RETURNCONTRACT:
|
||||
if !isInitCode {
|
||||
return nil, ErrIncompatibleContainerKind
|
||||
}
|
||||
arg := int(code[i+1])
|
||||
if arg >= len(container.ContainerSections) {
|
||||
return nil, fmt.Errorf("%w: arg %d, last %d, pos %d", ErrUnreachableCode, arg, len(container.ContainerSections), i)
|
||||
|
|
|
|||
Loading…
Reference in a new issue