-
Notifications
You must be signed in to change notification settings - Fork 85
Closed
Description
I discovered a bug where #[zeroize(drop)]
doesn't generate a Drop
implementation when used on enum
s. It seems to me that it was accidentally fixed by #847 in zeroize_derive version 1.2. The bug still exists in version 1.1.
If I'm not missing something and this bug is real, version 1.1 should probably be yanked and a report filed at the RustSec Advisory Database.
Cargo.toml
:
[dependencies]
zeroize = { version = "=1.4.2", features = ["zeroize_derive"] }
zeroize_derive = "=1.1"
lib.rs
:
use zeroize::Zeroize;
#[derive(Zeroize)]
#[zeroize(drop)]
pub struct Works {
field: Vec<u8>,
}
// This doesn't compile, because a conflicting implementation generated by `#[zeroize(drop)]`.
impl Drop for Works {
fn drop(&mut self) {
todo!()
}
}
#[derive(Zeroize)]
#[zeroize(drop)]
pub enum Fails {
Variant(Vec<u8>),
}
// This does compile with zeroize_derive version 1.1, meaning `#[zeroize(drop)]` didn't implement `Drop`.
impl Drop for Fails {
fn drop(&mut self) {
todo!()
}
}
Metadata
Metadata
Assignees
Labels
No labels