Skip to content

Commit

Permalink
Don't assume_init on uninitialized memory (#87)
Browse files Browse the repository at this point in the history
Fixes: #86
  • Loading branch information
LunNova authored Oct 25, 2024
1 parent 6e79093 commit 0fa354e
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 0fa354e

Please sign in to comment.