Skip to content

Commit

Permalink
zeroize: Add a zeroize test for MaybeUninit
Browse files Browse the repository at this point in the history
  • Loading branch information
elichai committed Jul 19, 2021
1 parent 6367445 commit 16f6d70
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions zeroize/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,14 @@ mod tests {
assert_eq!(arr.as_ref(), [0u8; 64].as_ref());
}

#[test]
fn zeroize_maybeuninit_byte_arrays() {
let mut arr = [MaybeUninit::new(42u64); 64];
arr.zeroize();
let arr_init: [u64; 64] = unsafe {core::mem::transmute(arr)};
assert_eq!(arr_init, [0u64; 64]);
}

#[cfg(feature = "alloc")]
#[test]
fn zeroize_vec() {
Expand Down

0 comments on commit 16f6d70

Please sign in to comment.