From f310cdb6839063e50808e1e52de94ba58f04c061 Mon Sep 17 00:00:00 2001 From: DyT9qC <104480715+DyT9qC@users.noreply.github.com> Date: Thu, 18 Jul 2024 20:35:55 +0800 Subject: [PATCH] fix: resolve arithmetic overflow in capture.rs --- programs/mpl-hybrid/src/instructions/capture.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/programs/mpl-hybrid/src/instructions/capture.rs b/programs/mpl-hybrid/src/instructions/capture.rs index d4ec469..bbbd02c 100644 --- a/programs/mpl-hybrid/src/instructions/capture.rs +++ b/programs/mpl-hybrid/src/instructions/capture.rs @@ -136,8 +136,7 @@ pub fn handler_capture_v1(ctx: Context) -> Result<()> { if Path::RerollMetadata.check(escrow.path) { let clock = Clock::get()?; // seed for the random number is a combination of the slot_hash - timestamp - let seed = u64::from_le_bytes(*most_recent).saturating_sub(clock.unix_timestamp as u64) - * escrow.count; + let seed = u64::from_le_bytes(*most_recent).saturating_sub(clock.unix_timestamp as u64); // remainder is the random number between the min and max let remainder = seed .checked_rem(escrow.max - escrow.min)