From 16efe510cb97bd6763d225c6b72e8c8ee5bcd522 Mon Sep 17 00:00:00 2001 From: ripatel-fd Date: Thu, 11 Apr 2024 04:56:19 +0200 Subject: [PATCH] Don't panic vote program if epoch number overflows (#730) Helps with fuzzing Co-authored-by: Richard Patel --- programs/vote/src/vote_state/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/vote/src/vote_state/mod.rs b/programs/vote/src/vote_state/mod.rs index b600ed5528c799..2a4b4a17ad6bfa 100644 --- a/programs/vote/src/vote_state/mod.rs +++ b/programs/vote/src/vote_state/mod.rs @@ -860,7 +860,7 @@ pub fn authorize( clock .leader_schedule_epoch .checked_add(1) - .expect("epoch should be much less than u64::MAX"), + .ok_or(InstructionError::InvalidAccountData)?, |epoch_authorized_voter| { // current authorized withdrawer or authorized voter must say "yay" if authorized_withdrawer_signer {