core: check call flags in LoadToken

Follow neo-project/neo#2292.
This commit is contained in:
Evgeniy Stratonikov 2021-02-25 18:14:46 +03:00
parent 4db5ef05f8
commit 663afbe4df

View file

@ -19,6 +19,9 @@ import (
func LoadToken(ic *interop.Context) func(id int32) error {
return func(id int32) error {
ctx := ic.VM.Context()
if !ctx.GetCallFlags().Has(callflag.ReadStates | callflag.AllowCall) {
return errors.New("invalid call flags")
}
tok := ctx.NEF.Tokens[id]
if int(tok.ParamCount) > ctx.Estack().Len() {
return errors.New("stack is too small")