Skip to content

Commit

Permalink
AEAD internals: Avoid ptr.add(0).
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Jan 23, 2025
1 parent 0cf7081 commit cdc10bf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/aead/overlapping/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@ impl<T> Overlapping<'_, T> {
// SAFETY: The constructor ensures that `src` is a valid range.
// Equivalent to `self.in_out[src.clone()].as_ptr()` but without
// worries about compatibility with the stacked borrows model.
let input = unsafe { output_const.add(self.src.start) };
// TODO(MSRV-1.80, probably): Avoid special casing 0; see
// https://github.com/rust-lang/rust/pull/117329
// https://github.com/rust-lang/rustc_codegen_gcc/issues/516
let input = if self.src.start == 0 {
output_const
} else {
unsafe { output_const.add(self.src.start) }
};
(input, output, len)
}

Expand Down

0 comments on commit cdc10bf

Please sign in to comment.