Skip to content

Commit

Permalink
restore existing overlapping overflow (#24010)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmay authored Mar 30, 2022
1 parent 125f963 commit b741b86
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions programs/bpf_loader/src/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,9 +1492,10 @@ impl<'a, 'b> SyscallObject<BpfError> for SyscallKeccak256<'a, 'b> {

/// This function is incorrect due to arithmetic overflow and only exists for
/// backwards compatibility. Instead use program_stubs::is_nonoverlapping.
#[allow(clippy::integer_arithmetic)]
fn check_overlapping_do_not_use(src_addr: u64, dst_addr: u64, n: u64) -> bool {
(src_addr <= dst_addr && src_addr.saturating_add(n) > dst_addr)
|| (dst_addr <= src_addr && dst_addr.saturating_add(n) > src_addr)
(src_addr <= dst_addr && src_addr + n > dst_addr)
|| (dst_addr <= src_addr && dst_addr + n > src_addr)
}

fn mem_op_consume<'a, 'b>(
Expand Down

0 comments on commit b741b86

Please sign in to comment.