From 654c4a658921a1f360ecf5fa5606600b6edd47da Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 16 Jul 2021 10:55:35 +0300 Subject: [PATCH] stackitem: properly pass allowInvalid on binary deserialization Otherwise DecodeBinaryProtected() is broken for arrays/maps. --- pkg/vm/stackitem/serialization.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/vm/stackitem/serialization.go b/pkg/vm/stackitem/serialization.go index 4fb5c2b56..b3e1b9407 100644 --- a/pkg/vm/stackitem/serialization.go +++ b/pkg/vm/stackitem/serialization.go @@ -212,7 +212,7 @@ func decodeBinary(r *io.BinReader, allowInvalid bool) Item { size := int(r.ReadVarUint()) arr := make([]Item, size) for i := 0; i < size; i++ { - arr[i] = DecodeBinary(r) + arr[i] = decodeBinary(r, allowInvalid) } if t == ArrayT { @@ -223,8 +223,8 @@ func decodeBinary(r *io.BinReader, allowInvalid bool) Item { size := int(r.ReadVarUint()) m := NewMap() for i := 0; i < size; i++ { - key := DecodeBinary(r) - value := DecodeBinary(r) + key := decodeBinary(r, allowInvalid) + value := decodeBinary(r, allowInvalid) if r.Err != nil { break }