Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't assume_init on uninitialized memory #87

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/linux/libunwind/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ impl Unwinder {
pub fn cursor(&self, thread: &crate::Thread) -> Result<Cursor> {
unsafe {
let upt = _UPT_create(thread.id()? as _);
let mut cursor = std::mem::MaybeUninit::uninit().assume_init();
let ret = init_remote(&mut cursor, self.addr_space, upt);
let mut cursor = std::mem::MaybeUninit::uninit();
let ret = init_remote(cursor.as_mut_ptr(), self.addr_space, upt);
if ret != 0 {
return Err(crate::Error::LibunwindError(Error::from(-ret)));
}
Ok(Cursor {
cursor,
cursor: cursor.assume_init(),
upt,
initial_frame: true,
})
Expand Down Expand Up @@ -106,7 +106,7 @@ impl Cursor {
unsafe {
let mut name = vec![0_u8 as c_char; 128];
let cursor = &self.cursor as *const _ as *mut _;
let mut raw_offset = std::mem::MaybeUninit::uninit().assume_init();
let mut raw_offset = 0;

loop {
match get_proc_name(cursor, name.as_mut_ptr(), name.len(), &mut raw_offset) {
Expand Down
Loading