Skip to content

Commit

Permalink
VoteState::deserialize_into: temporarily revert to as pointer cast
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrod committed Aug 1, 2024
1 parent acdf7c2 commit 339ce8c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sdk/program/src/vote/state/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Vote state
use std::{mem, ptr};
use std::mem;

#[cfg(not(target_os = "solana"))]
use bincode::deserialize;
Expand Down Expand Up @@ -494,7 +494,9 @@ impl VoteState {
) -> Result<(), InstructionError> {
// Rebind vote_state to *mut VoteState so that the &mut binding isn't
// accessible anymore, preventing accidental use after this point.
let vote_state = ptr::from_mut(vote_state);
//
// NOTE: switch to ptr::from_mut() once platform-tools moves to rustc >= 1.56
let vote_state = vote_state as *mut VoteState;

// Safety: vote_state is valid to_drop (see drop_in_place() docs). After
// dropping, the pointer is treated as uninitialized and only accessed
Expand Down

0 comments on commit 339ce8c

Please sign in to comment.