Skip to content

Commit

Permalink
trie, accounts/abi: add error-checks (#26914)
Browse files Browse the repository at this point in the history
  • Loading branch information
darioush committed Mar 17, 2023
1 parent f733657 commit b7bfbc1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion accounts/abi/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@ func UnpackRevert(data []byte) (string, error) {
if !bytes.Equal(data[:4], revertSelector) {
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:])
if err != nil {
return "", err
Expand Down
8 changes: 6 additions & 2 deletions trie/stacktrie.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b7bfbc1

Please sign in to comment.