Skip to content

Commit

Permalink
backport ptr aliasing bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Oct 4, 2024
1 parent 083e99e commit 715873c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions zlib-rs/src/read_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,9 @@ impl<'a> ReadBuf<'a> {
end: usize,
) {
if (end - start).next_multiple_of(core::mem::size_of::<C>()) <= (buf.len() - current) {
let ptr = buf.as_mut_ptr();
unsafe {
Self::copy_chunk_unchecked::<C>(
buf.as_ptr().add(start),
buf.as_mut_ptr().add(current),
buf.as_ptr().add(end),
)
Self::copy_chunk_unchecked::<C>(ptr.add(start), ptr.add(current), ptr.add(end))
}
} else {
// a full simd copy does not fit in the output buffer
Expand Down

0 comments on commit 715873c

Please sign in to comment.