Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
febo committed Oct 25, 2024
1 parent f4b3002 commit f8aa823
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sdk/pinocchio/src/lazy_entrypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,12 @@ impl InstructionContext {
/// before reading all accounts will result in undefined behavior.
#[inline(always)]
pub unsafe fn instruction_data_unchecked(&mut self) -> (&[u8], &Pubkey) {
let data_len = unsafe { *(self.input.add(self.offset) as *const usize) };
let data_len = *(self.input.add(self.offset) as *const usize);
// shadowing the offset to avoid leaving it in an inconsistent state
let offset = self.offset + core::mem::size_of::<u64>();
let data = unsafe { core::slice::from_raw_parts(self.input.add(offset), data_len) };
let data = core::slice::from_raw_parts(self.input.add(offset), data_len);

(data, unsafe {
&*(self.input.add(offset + data_len) as *const Pubkey)
})
(data, &*(self.input.add(offset + data_len) as *const Pubkey))
}
}

Expand Down

0 comments on commit f8aa823

Please sign in to comment.