Skip to content

Commit f531926

Browse files
committed
Fix multiply overflow error
1 parent b59c785 commit f531926

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sys/lib/libbenchnet/src/packettool.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub fn fix_udp_checksum(frame: &mut [u8]) {
5959
#[inline(always)]
6060
fn fnv_a(data: &[u8], state: &mut u64) {
6161
for byte in data.iter() {
62-
*state *= 0x100000001b3;
62+
*state = (*state).wrapping_mul(0x100000001b3);
6363
*state ^= u64::from(*byte);
6464
}
6565
}
@@ -92,7 +92,7 @@ pub fn get_flowhash(frame: &[u8]) -> Option<usize> {
9292
return None;
9393
}
9494
*/
95-
state *= 0x100000001b3;
95+
state = state.wrapping_mul(0x100000001b3);
9696
state ^= u64::from(proto);
9797

9898
// proto.hash(&mut h1);

0 commit comments

Comments
 (0)