mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
core/vm: move fix for JUMPF
This commit is contained in:
parent
658e4e5559
commit
cd7f772ab9
2 changed files with 2 additions and 7 deletions
|
|
@ -120,10 +120,8 @@ func validateCode(code []byte, section int, container *Container, jt *JumpTable,
|
||||||
if arg >= len(container.Types) {
|
if arg >= len(container.Types) {
|
||||||
return nil, fmt.Errorf("%w: arg %d, last %d, pos %d", ErrInvalidSectionArgument, arg, len(container.Types), i)
|
return nil, fmt.Errorf("%w: arg %d, last %d, pos %d", ErrInvalidSectionArgument, arg, len(container.Types), i)
|
||||||
}
|
}
|
||||||
// TODO check if that is actually a problem
|
if container.Types[arg].Output != 0x80 && container.Types[arg].Output > container.Types[section].Output {
|
||||||
// JUMPF operand must point to a code section with equal or fewer number of outputs as the section in which it resides, or to a section with 0x80 as outputs (non-returning)
|
return nil, fmt.Errorf("%w: arg %d, last %d, pos %d", ErrInvalidNumberOfOutputs, arg, len(container.Types), i)
|
||||||
if container.Types[arg].Output > container.Types[section].Output {
|
|
||||||
return nil, fmt.Errorf("%w: arg %d, last %d, pos %d", ErrInvalidSectionArgument, arg, len(container.Types), i)
|
|
||||||
}
|
}
|
||||||
visitedCode[arg] = struct{}{}
|
visitedCode[arg] = struct{}{}
|
||||||
case op == DATALOADN:
|
case op == DATALOADN:
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,6 @@ func validateControlFlow2(code []byte, section int, metadata []*FunctionMetadata
|
||||||
return 0, fmt.Errorf("%w: at pos %d", ErrStackUnderflow{stackLen: have, required: want}, pos)
|
return 0, fmt.Errorf("%w: at pos %d", ErrStackUnderflow{stackLen: have, required: want}, pos)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if metadata[section].Output < newSection.Output {
|
|
||||||
return 0, fmt.Errorf("%w: at pos %d", ErrInvalidNumberOfOutputs, pos)
|
|
||||||
}
|
|
||||||
if currentBounds.max != currentBounds.min {
|
if currentBounds.max != currentBounds.min {
|
||||||
return 0, fmt.Errorf("%w: max %d, min %d, at pos %d", ErrInvalidNumberOfOutputs, currentBounds.max, currentBounds.min, pos)
|
return 0, fmt.Errorf("%w: max %d, min %d, at pos %d", ErrInvalidNumberOfOutputs, currentBounds.max, currentBounds.min, pos)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue