Fix Lehmer64 implementation of next
. (#2912)
The implementation of [`Lehmer64Rand::next`] performs a mul on `u128`, which
is not checked against overflows. It leads to panic in debug mode.
[`Lehmer64Rand`]: fd6271fa35/libafl_bolts/src/rands/mod.rs (L373-L376)
Co-authored-by: Dongjia "toka" Zhang <tokazerkje@outlook.com>
This commit is contained in:
parent
d8df9b4910
commit
5c5f6affcb
@ -371,7 +371,7 @@ impl Rand for Lehmer64Rand {
|
|||||||
#[inline]
|
#[inline]
|
||||||
#[expect(clippy::unreadable_literal)]
|
#[expect(clippy::unreadable_literal)]
|
||||||
fn next(&mut self) -> u64 {
|
fn next(&mut self) -> u64 {
|
||||||
self.s *= 0xda942042e4dd58b5;
|
self.s = self.s.wrapping_mul(0xda942042e4dd58b5);
|
||||||
(self.s >> 64) as u64
|
(self.s >> 64) as u64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user