Skip to content

Commit cf69365

Browse files
authored
fix unsound pointer arithmetic (#185)
Closes #177
1 parent 42422dc commit cf69365

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'a> Bytes<'a> {
4545
pub fn peek_ahead(&self, n: usize) -> Option<u8> {
4646
// SAFETY: obtain a potentially OOB pointer that is later compared against the `self.end`
4747
// pointer.
48-
let ptr = unsafe { self.cursor.add(n) };
48+
let ptr = self.cursor.wrapping_add(n);
4949
if ptr < self.end {
5050
// SAFETY: bounds checked pointer dereference is safe
5151
Some(unsafe { *ptr })

0 commit comments

Comments
 (0)