reading mask without preceding nil value

This commit is contained in:
Pavel Merzlyakov 2023-07-27 01:51:27 +03:00
parent 800c5d04d0
commit de9695a724
1 changed files with 4 additions and 14 deletions

View File

@ -530,25 +530,15 @@ func (rd *msgpackReader) Skip() error {
}
func (rd *msgpackReader) TryReadMask() (bool, FieldsMask, error) {
code, err := rd.dec.PeekCode()
maskLen, err := rd.dec.DecodeArrayLen()
if err != nil {
return false, FieldsMask{}, errors.WithStack(err)
}
if code != msgpcode.Nil {
if err == io.EOF {
return false, FieldsMask{}, nil
}
if err := rd.dec.Skip(); err != nil {
return false, FieldsMask{}, errors.WithStack(err)
}
var mask FieldsMask
maskLen, err := rd.dec.DecodeArrayLen()
if err != nil {
return false, FieldsMask{}, errors.WithStack(err)
}
for i := 0; i < maskLen; i++ {
maskPart, err := rd.dec.DecodeUint64()
if err != nil {