Skip to content

Commit

Permalink
inflate/bitreader: fix unsoundness in advance()
Browse files Browse the repository at this point in the history
  • Loading branch information
inahga authored and folkertdev committed Nov 4, 2024
1 parent 04d9395 commit 7d2d71d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zlib-rs/src/inflate/bitreader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<'a> BitReader<'a> {

#[inline(always)]
pub fn advance(&mut self, bytes: usize) {
self.ptr = Ord::min(unsafe { self.ptr.add(bytes) }, self.end);
self.ptr = Ord::min(self.ptr.wrapping_add(bytes), self.end);
}

#[inline(always)]
Expand Down

0 comments on commit 7d2d71d

Please sign in to comment.