Skip to content

Commit

Permalink
checks namespaced data validity and makes an explicit panic
Browse files Browse the repository at this point in the history
  • Loading branch information
staheri14 committed Feb 28, 2023
1 parent faf4e50 commit aa5a48b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ func (n *Hasher) HashLeaf(ndata []byte) []byte {
h := n.baseHasher
h.Reset()

if err := n.IsNamespacedData(ndata); err != nil {
panic(err)
}

nID := ndata[:n.NamespaceLen]
resLen := int(2*n.NamespaceLen) + n.baseHasher.Size()
minMaxNIDs := make([]byte, 0, resLen)
Expand Down

0 comments on commit aa5a48b

Please sign in to comment.