celestiaorg/nmt

VerifyNamespace panics if called on an empty range, but with non-empty nodes

Closed this issue · 0 comments

If VerifyNamespace is called with a proof that has an empty range (e.g., start=end=0), but non-empty nodes, it will panic. An example proof that would cause the panic is

customNode := []byte{7}
panickingProof := Proof{
	start:                   0,
	end:                     0,
	nodes:                   [][]byte{customNode},
	leafHash:                []byte{},
	isMaxNamespaceIDIgnored: true,
	}

VerifyNamespace does check for empty range, but only together with empty nodes. The panic happens in the getSplitPoint function.

The test case illustrating the issue is here.

This issue is similar in nature to #140. It was uncovered using tests generated by PR #163 .