Skip to content

Commit

Permalink
Fix out of bounds when verifying malformed proofs
Browse files Browse the repository at this point in the history
  • Loading branch information
dkuehr committed Feb 24, 2025
1 parent dec49a9 commit e957b6b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kimchi/src/circuits/polynomials/endomul_scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
},
curve::KimchiCurve,
};
use ark_ff::{BitIteratorLE, BigInteger, Field, PrimeField};
use ark_ff::{BigInteger, BitIteratorLE, Field, PrimeField};
use std::array;
use std::marker::PhantomData;

Expand Down
7 changes: 7 additions & 0 deletions poly-commitment/src/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,13 @@ impl<G: CommitmentCurve> SRS<G> {

let s = b_poly_coefficients(&chal);

debug_assert!(s.len() <= scalars.len());

// TODO: implement a better solution at type/wire level, for now we just bail out...
if s.len() > scalars.len() {
return false;
}

let neg_rand_base_i = -rand_base_i;

// TERM
Expand Down
4 changes: 3 additions & 1 deletion signer/src/keypair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ impl Keypair {
pub fn secret_multiply_with_curve_point(&self, multiplicand: CurvePoint) -> CurvePoint {
use ark_ec::AffineCurve;
use ark_ec::ProjectiveCurve;
multiplicand.mul(self.secret.clone().into_scalar()).into_affine()
multiplicand
.mul(self.secret.clone().into_scalar())
.into_affine()
}
}

Expand Down

0 comments on commit e957b6b

Please sign in to comment.