Skip to content

Commit 982f020

Browse files
authored
Merge pull request #1063 from openmina/fuzzer_fixes
verification: prevent dump files during fuzzing
2 parents 91481e6 + 9579a98 commit 982f020

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ledger/src/proofs/step.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,12 @@ pub fn expand_deferred(params: ExpandDeferredParams) -> Result<DeferredValues<Fp
19481948
let zeta = ScalarChallenge::limbs_to_field(&plonk0.zeta_bytes);
19491949
let alpha = ScalarChallenge::limbs_to_field(&plonk0.alpha_bytes);
19501950
let step_domain: u8 = proof_state.deferred_values.branch_data.domain_log2.as_u8();
1951-
let Some(domain) = Radix2EvaluationDomain::<Fp>::new(1 << step_domain as u64) else {
1951+
1952+
let Some(num_coeffs) = 1u64.checked_shl(step_domain as u32) else {
1953+
return Err(InvalidBigInt);
1954+
};
1955+
1956+
let Some(domain) = Radix2EvaluationDomain::<Fp>::new(num_coeffs as usize) else {
19521957
return Err(InvalidBigInt);
19531958
};
19541959

ledger/src/proofs/verification.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ mod on_fail {
976976

977977
#[allow(unreachable_code)]
978978
fn dump_to_file<D: BinProtWrite>(data: &D, filename: &str) {
979-
#[cfg(test)]
979+
#[cfg(any(test, feature = "fuzzing"))]
980980
{
981981
let (_, _) = (data, filename); // avoid unused vars
982982
return;

0 commit comments

Comments
 (0)