diff --git a/libafl/src/events/llmp/restarting.rs b/libafl/src/events/llmp/restarting.rs index 370b4ca39a..82630e0c0b 100644 --- a/libafl/src/events/llmp/restarting.rs +++ b/libafl/src/events/llmp/restarting.rs @@ -35,10 +35,10 @@ use serde::{Deserialize, Serialize}; #[cfg(feature = "std")] use typed_builder::TypedBuilder; -#[cfg(feature = "std")] -use crate::events::{AdaptiveSerializer, CustomBufEventResult, HasCustomBufHandlers}; #[cfg(all(unix, feature = "std", not(miri)))] use crate::events::EVENTMGR_SIGHANDLER_STATE; +#[cfg(feature = "std")] +use crate::events::{AdaptiveSerializer, CustomBufEventResult, HasCustomBufHandlers}; use crate::{ events::{ Event, EventConfig, EventFirer, EventManager, EventManagerHooksTuple, EventManagerId, diff --git a/libafl/src/stages/calibrate.rs b/libafl/src/stages/calibrate.rs index c1c584af78..7a16cfa8ea 100644 --- a/libafl/src/stages/calibrate.rs +++ b/libafl/src/stages/calibrate.rs @@ -2,6 +2,7 @@ use alloc::{ borrow::{Cow, ToOwned}, + string::ToString, vec::Vec, }; use core::{fmt::Debug, marker::PhantomData, time::Duration}; @@ -260,7 +261,14 @@ where let map = observers[&self.map_observer_handle].as_ref(); let mut bitmap_size = map.count_bytes(); - assert!(bitmap_size != 0); + + if bitmap_size < 1 { + return Err(Error::invalid_corpus( + "This testcase doesnot trigger trigger any edges. Check your instrumentation!" + .to_string(), + )); + } + bitmap_size = bitmap_size.max(1); // just don't make it 0 because we take log2 of it later. let psmeta = state .metadata_map_mut()