Align host addresses (#11384)
* Align host addresses * support new program abi * update epoch rollout * Enforce aligned pointers in cross-program invocations
This commit is contained in:
@@ -76,9 +76,18 @@ pub unsafe fn deserialize<'a>(input: *mut u8) -> (&'a Pubkey, Vec<AccountInfo<'a
|
||||
let is_writable = *(input.add(offset) as *const u8) != 0;
|
||||
offset += size_of::<u8>();
|
||||
|
||||
#[allow(clippy::cast_ptr_alignment)]
|
||||
let executable = *(input.add(offset) as *const u8) != 0;
|
||||
offset += size_of::<u8>();
|
||||
|
||||
offset += 4; // padding
|
||||
|
||||
let key: &Pubkey = &*(input.add(offset) as *const Pubkey);
|
||||
offset += size_of::<Pubkey>();
|
||||
|
||||
let owner: &Pubkey = &*(input.add(offset) as *const Pubkey);
|
||||
offset += size_of::<Pubkey>();
|
||||
|
||||
#[allow(clippy::cast_ptr_alignment)]
|
||||
let lamports = Rc::new(RefCell::new(&mut *(input.add(offset) as *mut u64)));
|
||||
offset += size_of::<u64>();
|
||||
@@ -92,12 +101,7 @@ pub unsafe fn deserialize<'a>(input: *mut u8) -> (&'a Pubkey, Vec<AccountInfo<'a
|
||||
}));
|
||||
offset += data_len;
|
||||
|
||||
let owner: &Pubkey = &*(input.add(offset) as *const Pubkey);
|
||||
offset += size_of::<Pubkey>();
|
||||
|
||||
#[allow(clippy::cast_ptr_alignment)]
|
||||
let executable = *(input.add(offset) as *const u8) != 0;
|
||||
offset += size_of::<u8>();
|
||||
offset += 16 - (offset % 16); // padding
|
||||
|
||||
#[allow(clippy::cast_ptr_alignment)]
|
||||
let rent_epoch = *(input.add(offset) as *const u64);
|
||||
@@ -114,6 +118,8 @@ pub unsafe fn deserialize<'a>(input: *mut u8) -> (&'a Pubkey, Vec<AccountInfo<'a
|
||||
rent_epoch,
|
||||
});
|
||||
} else {
|
||||
offset += 7; // padding
|
||||
|
||||
// Duplicate account, clone the original
|
||||
accounts.push(accounts[dup_info as usize].clone());
|
||||
}
|
||||
|
Reference in New Issue
Block a user