Don't panic even if bitmap is zero in calibrate.rs (#2419)
This commit is contained in:
parent
c96ea616fe
commit
536f00a056
@ -35,10 +35,10 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use typed_builder::TypedBuilder;
|
use typed_builder::TypedBuilder;
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
use crate::events::{AdaptiveSerializer, CustomBufEventResult, HasCustomBufHandlers};
|
|
||||||
#[cfg(all(unix, feature = "std", not(miri)))]
|
#[cfg(all(unix, feature = "std", not(miri)))]
|
||||||
use crate::events::EVENTMGR_SIGHANDLER_STATE;
|
use crate::events::EVENTMGR_SIGHANDLER_STATE;
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use crate::events::{AdaptiveSerializer, CustomBufEventResult, HasCustomBufHandlers};
|
||||||
use crate::{
|
use crate::{
|
||||||
events::{
|
events::{
|
||||||
Event, EventConfig, EventFirer, EventManager, EventManagerHooksTuple, EventManagerId,
|
Event, EventConfig, EventFirer, EventManager, EventManagerHooksTuple, EventManagerId,
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use alloc::{
|
use alloc::{
|
||||||
borrow::{Cow, ToOwned},
|
borrow::{Cow, ToOwned},
|
||||||
|
string::ToString,
|
||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
use core::{fmt::Debug, marker::PhantomData, time::Duration};
|
use core::{fmt::Debug, marker::PhantomData, time::Duration};
|
||||||
@ -260,7 +261,14 @@ where
|
|||||||
let map = observers[&self.map_observer_handle].as_ref();
|
let map = observers[&self.map_observer_handle].as_ref();
|
||||||
|
|
||||||
let mut bitmap_size = map.count_bytes();
|
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.
|
bitmap_size = bitmap_size.max(1); // just don't make it 0 because we take log2 of it later.
|
||||||
let psmeta = state
|
let psmeta = state
|
||||||
.metadata_map_mut()
|
.metadata_map_mut()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user