From 28db438a8e4a0e2aa0e1d95dc3cf0b379da177ea Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Fri, 2 Aug 2024 07:37:24 -0600 Subject: [PATCH] CALLF Stack validation height CALLF should use the target function data when checking stack overflow. --- core/vm/eips.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/vm/eips.go b/core/vm/eips.go index 179321eb87..69213b5d8f 100644 --- a/core/vm/eips.go +++ b/core/vm/eips.go @@ -809,9 +809,9 @@ func opCallf(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by var ( code = scope.Contract.CodeAt(scope.CodeSection) idx = binary.BigEndian.Uint16(code[*pc+1:]) - typ = scope.Contract.Container.Types[scope.CodeSection] + typ = scope.Contract.Container.Types[idx] ) - if scope.Stack.len()+int(typ.MaxStackHeight) >= 1024 { + if scope.Stack.len()+int(typ.MaxStackHeight)-int(typ.Input) > 1024 { return nil, fmt.Errorf("stack overflow") } if len(scope.ReturnStack) > 1024 {