Skip to content

Commit

Permalink
wrapping_mul
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Aug 7, 2024
1 parent da7752f commit 7cce968
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion transaction-view/src/instructions_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ impl InstructionsMeta {
// Each instruction needs at least 3 bytes, so do a sanity check here to
// ensure we have enough bytes to read the number of instructions.
let num_instructions = optimized_read_compressed_u16(bytes, offset)?;
check_remaining(bytes, *offset, 3 * usize::from(num_instructions))?;
check_remaining(
bytes,
*offset,
3usize.wrapping_mul(usize::from(num_instructions)),
)?;

// We know the offset does not exceed packet length, and our packet
// length is less than u16::MAX, so we can safely cast to u16.
Expand Down

0 comments on commit 7cce968

Please sign in to comment.