Skip to content

Commit

Permalink
Bugfix: unsafe precondition(s) violated: slice::from_raw_parts requir…
Browse files Browse the repository at this point in the history
…es the pointer to be aligned and non-null, and the total size of the slice not to exceed isize::MAX

#128
  • Loading branch information
evgenyigumnov authored Jul 15, 2024
1 parent 480de12 commit e7afef0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,9 @@ where
ffi::ARCHIVE_EOF => return Ok(written),
value => archive_result(value, archive_reader)?,
}

if size == 0 {
return Ok(written);
}
let content = slice::from_raw_parts(buffer as *const u8, size);
target.write_all(content)?;
written += size;
Expand Down

0 comments on commit e7afef0

Please sign in to comment.