Skip to content

Commit c591923

Browse files
committed
Fix get_unchecked UB by raw pointer calculation
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
1 parent 0de660e commit c591923

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crossbeam-skiplist/src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<K, V> Index<usize> for Tower<K, V> {
3636
fn index(&self, index: usize) -> &Atomic<Node<K, V>> {
3737
// This implementation is actually unsafe since we don't check if the
3838
// index is in-bounds. But this is fine since this is only used internally.
39-
unsafe { self.pointers.get_unchecked(index) }
39+
unsafe { &*(&self.pointers as *const Atomic<Node<K, V>>).add(index) }
4040
}
4141
}
4242

0 commit comments

Comments
 (0)