Created
September 17, 2019 12:58
-
-
Save rust-play/dda27a9c80518d90c4636263a12d75fe to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let raw_vec: *mut Vec<i32>; | |
{ | |
let mut my_vec = vec![1, 2, 3, 4, 5]; | |
raw_vec = &mut my_vec as *mut Vec<i32>; | |
} | |
// Example use of leaked pointer | |
unsafe { println!("{:?}", *raw_vec); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment