Skip to content

Commit e957b6b

Browse files
author
Daniel Kuehr
committed
Fix out of bounds when verifying malformed proofs
1 parent dec49a9 commit e957b6b

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

kimchi/src/circuits/polynomials/endomul_scalar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
},
1212
curve::KimchiCurve,
1313
};
14-
use ark_ff::{BitIteratorLE, BigInteger, Field, PrimeField};
14+
use ark_ff::{BigInteger, BitIteratorLE, Field, PrimeField};
1515
use std::array;
1616
use std::marker::PhantomData;
1717

poly-commitment/src/commitment.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,13 @@ impl<G: CommitmentCurve> SRS<G> {
739739

740740
let s = b_poly_coefficients(&chal);
741741

742+
debug_assert!(s.len() <= scalars.len());
743+
744+
// TODO: implement a better solution at type/wire level, for now we just bail out...
745+
if s.len() > scalars.len() {
746+
return false;
747+
}
748+
742749
let neg_rand_base_i = -rand_base_i;
743750

744751
// TERM

signer/src/keypair.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ impl Keypair {
9898
pub fn secret_multiply_with_curve_point(&self, multiplicand: CurvePoint) -> CurvePoint {
9999
use ark_ec::AffineCurve;
100100
use ark_ec::ProjectiveCurve;
101-
multiplicand.mul(self.secret.clone().into_scalar()).into_affine()
101+
multiplicand
102+
.mul(self.secret.clone().into_scalar())
103+
.into_affine()
102104
}
103105
}
104106

0 commit comments

Comments
 (0)