Hi!
|
fn zeroize(&mut self) { |
|
// Zeroize all the initialized elements. |
|
self.iter_mut().zeroize(); |
|
|
|
// Set the Vec's length to 0 and drop all the elements. |
|
self.clear(); |
|
|
|
// Zero the full capacity of `Vec`. |
|
self.spare_capacity_mut().zeroize(); |
:
fn zeroize(&mut self) {
// Zeroize all the initialized elements.
self.iter_mut().zeroize();
// Set the Vec's length to 0 and drop all the elements.
self.clear();
// Zero the full capacity of `Vec`.
self.spare_capacity_mut().zeroize();
}
After self.clear(), len is 0, so self.spare_capacity_mut() in the third step covers the entire allocation, including the range that was already zeroized by the first step.
Is there are reason for that? If so, a comment might help.
Thank you
Hi!
utils/zeroize/src/lib.rs
Lines 528 to 536 in 03a330e
After self.clear(), len is 0, so self.spare_capacity_mut() in the third step covers the entire allocation, including the range that was already zeroized by the first step.
Is there are reason for that? If so, a comment might help.
Thank you