From 4cccdf1378bcf322ff8305cd8d0ec30b42fe6020 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Wed, 16 Dec 2020 14:11:39 +0100 Subject: [PATCH] make eqv happy :) --- afl/Cargo.toml | 1 + afl/src/lib.rs | 3 +++ afl/src/serde_anymap.rs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/afl/Cargo.toml b/afl/Cargo.toml index d0b023a8e8..328552e0bc 100644 --- a/afl/Cargo.toml +++ b/afl/Cargo.toml @@ -39,3 +39,4 @@ xxhash-rust = { version = "0.8.0", features = ["xxh3"] } # xxh3 hashing for rust serde = { version = "1.0", default-features = false, features = ["alloc"] } # serialization lib erased-serde = "0.3.12" postcard = { version = "0.5.1", features = ["alloc"] } # no_std compatible serde serialization fromat +static_assertions = "1.1.0" diff --git a/afl/src/lib.rs b/afl/src/lib.rs index 0571ff0bde..7597b4c746 100644 --- a/afl/src/lib.rs +++ b/afl/src/lib.rs @@ -7,6 +7,9 @@ Welcome to libAFL #[macro_use] extern crate alloc; +#[macro_use] +extern crate static_assertions; + pub mod corpus; pub mod engines; pub mod events; diff --git a/afl/src/serde_anymap.rs b/afl/src/serde_anymap.rs index 94062b567d..4cab18cb85 100644 --- a/afl/src/serde_anymap.rs +++ b/afl/src/serde_anymap.rs @@ -7,10 +7,12 @@ use core::any::{Any, TypeId}; // yolo pub fn pack_type_id(id: u64) -> TypeId { + assert_eq_size!(TypeId, u64); unsafe { *(&id as *const u64 as *const TypeId) } } pub fn unpack_type_id(id: TypeId) -> u64 { + assert_eq_size!(TypeId, u64); unsafe { *(&id as *const _ as *const u64) } }