trie: add error-checks #26914 (#1138)

This commit is contained in:
Daniel Liu 2025-12-19 15:47:02 +08:00 committed by GitHub
parent 56ef5f3956
commit b08622248c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -144,7 +144,9 @@ func (st *StackTrie) unmarshalBinary(r io.Reader) error {
Val []byte
Key []byte
}
gob.NewDecoder(r).Decode(&dec)
if err := gob.NewDecoder(r).Decode(&dec); err != nil {
return err
}
st.owner = dec.Owner
st.nodeType = dec.NodeType
st.val = dec.Val
@ -158,7 +160,9 @@ func (st *StackTrie) unmarshalBinary(r io.Reader) error {
continue
}
var child StackTrie
child.unmarshalBinary(r)
if err := child.unmarshalBinary(r); err != nil {
return err
}
st.children[i] = &child
}
return nil