mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-12 02:56:37 +00:00
core/vm: fix off-by-one error
This commit is contained in:
parent
644823db48
commit
8a84cd1b97
1 changed files with 2 additions and 2 deletions
|
|
@ -131,7 +131,7 @@ func opEOFCreate(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) (
|
||||||
offset, size = scope.Stack.pop(), scope.Stack.pop()
|
offset, size = scope.Stack.pop(), scope.Stack.pop()
|
||||||
input = scope.Memory.GetCopy(offset.Uint64(), size.Uint64())
|
input = scope.Memory.GetCopy(offset.Uint64(), size.Uint64())
|
||||||
)
|
)
|
||||||
if int(idx) >= len(scope.Contract.Container.subContainerOffsets) {
|
if int(idx) >= len(scope.Contract.Container.subContainerOffsets)-1 {
|
||||||
return nil, fmt.Errorf("invalid subcontainer")
|
return nil, fmt.Errorf("invalid subcontainer")
|
||||||
}
|
}
|
||||||
subContainer := scope.Contract.Container.subContainerAt(int(idx))
|
subContainer := scope.Contract.Container.subContainerAt(int(idx))
|
||||||
|
|
@ -182,7 +182,7 @@ func opReturnContract(pc *uint64, interpreter *EVMInterpreter, scope *ScopeConte
|
||||||
offset = scope.Stack.pop()
|
offset = scope.Stack.pop()
|
||||||
size = scope.Stack.pop()
|
size = scope.Stack.pop()
|
||||||
)
|
)
|
||||||
if int(idx) >= len(scope.Contract.Container.subContainerOffsets) {
|
if int(idx) >= len(scope.Contract.Container.subContainerOffsets)-1 {
|
||||||
return nil, fmt.Errorf("invalid subcontainer")
|
return nil, fmt.Errorf("invalid subcontainer")
|
||||||
}
|
}
|
||||||
ret := scope.Memory.GetPtr(offset.Uint64(), size.Uint64())
|
ret := scope.Memory.GetPtr(offset.Uint64(), size.Uint64())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue