Skip to content

Commit

Permalink
fix: Add recovery ID check to secp256k1_recover syscall (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
conr2d authored Jan 3, 2025
1 parent 3847333 commit 20d4f6e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vendor/solana/programs/bpf_loader/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,9 @@ declare_builtin_function!(
let Ok(recovery_id) = recovery_id_val.try_into() else {
return Ok(Secp256k1RecoverError::InvalidRecoveryId.into());
};
if recovery_id > 3 {
return Ok(Secp256k1RecoverError::InvalidRecoveryId.into());
}
if signature.len() != SECP256K1_SIGNATURE_LENGTH {
return Ok(Secp256k1RecoverError::InvalidSignature.into());
}
Expand Down

0 comments on commit 20d4f6e

Please sign in to comment.