taurushq-io / multi-party-sig

Implementation of protocols for threshold signatures
Apache License 2.0
312 stars 120 forks source link

Panic on verifying Nil Proof in proof.Verify function #99

Closed frenkel26 closed 1 year ago

frenkel26 commented 1 year ago

Description

For some zk proofs, when the proof is absent from the message, the verifier panics with nil dereference.

Details

Some proofs implement the Verify function as a pointer receiver, like this:

func (p *Proof) Verify(hash *hash.Hash, ...) bool {
    if !p.IsValid() {
        return false
    }

if p == nil, then p.IsValid will catch it.

Other proofs implement the Verify function as a value receiver, like this:

func (p Proof) Verify(hash *hash.Hash, ...) bool {
    if !p.IsValid() {
        return false
    }

if p == nil, the casting will result with nil dereference.