Unverified Commit b7bfbc1e authored by Darioush Jalali's avatar Darioush Jalali Committed by GitHub

trie, accounts/abi: add error-checks (#26914)

parent f7336573
...@@ -246,7 +246,10 @@ func UnpackRevert(data []byte) (string, error) { ...@@ -246,7 +246,10 @@ func UnpackRevert(data []byte) (string, error) {
if !bytes.Equal(data[:4], revertSelector) { if !bytes.Equal(data[:4], revertSelector) {
return "", errors.New("invalid data for unpacking") return "", errors.New("invalid data for unpacking")
} }
typ, _ := NewType("string", "", nil) typ, err := NewType("string", "", nil)
if err != nil {
return "", err
}
unpacked, err := (Arguments{{Type: typ}}).Unpack(data[4:]) unpacked, err := (Arguments{{Type: typ}}).Unpack(data[4:])
if err != nil { if err != nil {
return "", err return "", err
......
...@@ -144,7 +144,9 @@ func (st *StackTrie) unmarshalBinary(r io.Reader) error { ...@@ -144,7 +144,9 @@ func (st *StackTrie) unmarshalBinary(r io.Reader) error {
Val []byte Val []byte
Key []byte Key []byte
} }
gob.NewDecoder(r).Decode(&dec) if err := gob.NewDecoder(r).Decode(&dec); err != nil {
return err
}
st.owner = dec.Owner st.owner = dec.Owner
st.nodeType = dec.NodeType st.nodeType = dec.NodeType
st.val = dec.Val st.val = dec.Val
...@@ -158,7 +160,9 @@ func (st *StackTrie) unmarshalBinary(r io.Reader) error { ...@@ -158,7 +160,9 @@ func (st *StackTrie) unmarshalBinary(r io.Reader) error {
continue continue
} }
var child StackTrie var child StackTrie
child.unmarshalBinary(r) if err := child.unmarshalBinary(r); err != nil {
return err
}
st.children[i] = &child st.children[i] = &child
} }
return nil return nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment