stackitem: properly pass allowInvalid on binary deserialization

Otherwise DecodeBinaryProtected() is broken for arrays/maps.
This commit is contained in:
Roman Khimov 2021-07-16 10:55:35 +03:00
parent 3a991abb62
commit 654c4a6589

View file

@ -212,7 +212,7 @@ func decodeBinary(r *io.BinReader, allowInvalid bool) Item {
size := int(r.ReadVarUint()) size := int(r.ReadVarUint())
arr := make([]Item, size) arr := make([]Item, size)
for i := 0; i < size; i++ { for i := 0; i < size; i++ {
arr[i] = DecodeBinary(r) arr[i] = decodeBinary(r, allowInvalid)
} }
if t == ArrayT { if t == ArrayT {
@ -223,8 +223,8 @@ func decodeBinary(r *io.BinReader, allowInvalid bool) Item {
size := int(r.ReadVarUint()) size := int(r.ReadVarUint())
m := NewMap() m := NewMap()
for i := 0; i < size; i++ { for i := 0; i < size; i++ {
key := DecodeBinary(r) key := decodeBinary(r, allowInvalid)
value := DecodeBinary(r) value := decodeBinary(r, allowInvalid)
if r.Err != nil { if r.Err != nil {
break break
} }