Skip to content

Commit

Permalink
Fix get_unchecked UB by raw pointer calculation
Browse files Browse the repository at this point in the history
Signed-off-by: Yilin Chen <[email protected]>
  • Loading branch information
sticnarf committed Dec 15, 2022
1 parent 0de660e commit c591923
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crossbeam-skiplist/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<K, V> Index<usize> for Tower<K, V> {
fn index(&self, index: usize) -> &Atomic<Node<K, V>> {
// This implementation is actually unsafe since we don't check if the
// index is in-bounds. But this is fine since this is only used internally.
unsafe { self.pointers.get_unchecked(index) }
unsafe { &*(&self.pointers as *const Atomic<Node<K, V>>).add(index) }
}
}

Expand Down

0 comments on commit c591923

Please sign in to comment.