Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack overflow in BatchMerkleProof.valid #96

Closed
SethDusek opened this issue Apr 27, 2022 · 1 comment · Fixed by #109
Closed

Stack overflow in BatchMerkleProof.valid #96

SethDusek opened this issue Apr 27, 2022 · 1 comment · Fixed by #109

Comments

@SethDusek
Copy link

As part of ergoplatform/sigma-rust implementation of BatchMerkleProof #538, I found a way to trigger stack overflow in BatchMerkleProof::valid implementation. After some testing, this issue occured in both the scala implementation and Rust. In loop() code, if a is empty, then it will still keep recursing and passing yet another empty array of indices to loop(). Here is a minimally failing example:

val batch = BatchMerkleProof(Seq(), Seq((Digest32 @@ Array.fill[Byte](32)(0),MerkleProof.LeftSide)))
batch.valid(Digest32 @@ Array.fill[Byte](32)(0))
@ApexTheory
Copy link
Contributor

I'll be working on this.
Reference: ergoplatform/sigma-rust@88c4717

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants