Skip to content

Commit 5c5f6af

Browse files
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`]: https://github.com/AFLplusplus/LibAFL/blob/fd6271fa356f3addda6db33f37db7e42a2c99bbc/libafl_bolts/src/rands/mod.rs#L373-L376 Co-authored-by: Dongjia "toka" Zhang <tokazerkje@outlook.com>
1 parent d8df9b4 commit 5c5f6af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libafl_bolts/src/rands/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ impl Rand for Lehmer64Rand {
371371
#[inline]
372372
#[expect(clippy::unreadable_literal)]
373373
fn next(&mut self) -> u64 {
374-
self.s *= 0xda942042e4dd58b5;
374+
self.s = self.s.wrapping_mul(0xda942042e4dd58b5);
375375
(self.s >> 64) as u64
376376
}
377377
}

0 commit comments

Comments
 (0)