This repository has been archived by the owner on Feb 27, 2023. It is now read-only.
(*SparseMerkleTree).th.parseNode should check that data retrieved is within limits else panic #58
Labels
bug
Something isn't working
If we look at this code here
smt/treehasher.go
Lines 68 to 70 in a99c0f5
we notice that the authors assumed that we'd always have data with a length of at least 33 bytes. However, this code unfortunately doesn't recall that to create a SparseMerkleTree, we need to pass in the nodes MapStore as well as the values MapStore. If we run this code, we'll get a panic:
Suggestion
Given this package is going to be general purpose, we need to also be defensive about code whose limits that we know we control, we should return errors and be defensive whenever we try to access data with blind bounds
/cc @cuonglm @adlerjohn @liamsi
The text was updated successfully, but these errors were encountered: