Reset headers with a memcpy, not an assign from zeroed (#1443)

This commit is contained in:
Rowan Hart 2023-08-22 23:23:52 -07:00 committed by GitHub
parent 174b852e0a
commit 942c6a42ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -631,7 +631,6 @@ pub struct AFLppCmpHeader {
#[bitfield(name = "reserved", ty = "u32", bits = "60..=63")]
data: [u8; 8],
}
/// The AFL++ `cmp_operands` struct
#[derive(Default, Debug, Clone, Copy)]
#[repr(C, packed)]
@ -814,8 +813,8 @@ impl CmpMap for AFLppCmpMap {
fn reset(&mut self) -> Result<(), Error> {
// For performance, we reset just the headers
self.headers = unsafe { core::mem::zeroed() };
// self.vals.operands = unsafe { core::mem::zeroed() };
self.headers.fill(AFLppCmpHeader { data: [0; 8] });
Ok(())
}
}