You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zeroize: Vec<Z>::zeroize() zeroizes the initialized elements twice #1524
// 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();
:
fnzeroize(&mutself){// 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.
Activity
zeroize: avoid double-zeroizing Vec's initialized elements (#1525)