Use read_unaligned with *u8 cast to *u32

Avoids undefined behavior due to unaligned read caught with Miri
This commit is contained in:
Bob Peterson
2025-10-19 23:38:34 -05:00
parent 5d7b057b8a
commit 2cb0a9b34b

View File

@@ -2857,7 +2857,8 @@ impl BTreeCursor {
// load sibling pages
// start loading right page first
let mut pgno: u32 = unsafe { right_pointer.cast::<u32>().read().swap_bytes() };
let mut pgno: u32 =
unsafe { right_pointer.cast::<u32>().read_unaligned().swap_bytes() };
let current_sibling = sibling_pointer;
let mut group = CompletionGroup::new(|_| {});
for i in (0..=current_sibling).rev() {