From 25ed5fcd60c40705df1b5c63a1c5a45035820838 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 7 Feb 2023 11:39:17 +0300 Subject: [PATCH] vm: allow custom limit duing Map\Array\Struct deserialization --- pkg/vm/stackitem/serialization.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/vm/stackitem/serialization.go b/pkg/vm/stackitem/serialization.go index f739817c3..baab7fcd6 100644 --- a/pkg/vm/stackitem/serialization.go +++ b/pkg/vm/stackitem/serialization.go @@ -304,7 +304,7 @@ func (r *deserContext) decodeBinary() Item { return NewBigInteger(num) case ArrayT, StructT: size := int(r.ReadVarUint()) - if size > MaxDeserialized { + if size > r.limit { r.Err = errTooBigElements return nil } @@ -319,7 +319,7 @@ func (r *deserContext) decodeBinary() Item { return NewStruct(arr) case MapT: size := int(r.ReadVarUint()) - if size > MaxDeserialized { + if size > r.limit/2 { r.Err = errTooBigElements return nil }