Skip to content

Commit

Permalink
Better error message instead of "No entries in corpus"
Browse files Browse the repository at this point in the history
  • Loading branch information
tokatoka authored Mar 15, 2024
1 parent c6875b8 commit 34b4a6a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libafl/src/schedulers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ where
/// Gets the next entry at random
fn next(&mut self, state: &mut Self::State) -> Result<CorpusId, Error> {
if state.corpus().count() == 0 {
Err(Error::empty("No entries in corpus".to_owned()))
Err(Error::empty("No entries in corpus. This often implies the target is not properly instrumented.".to_owned()))
} else {
let id = random_corpus_id!(state.corpus(), state.rand_mut());
self.set_current_scheduled(state, Some(id))?;
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/schedulers/powersched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ where

fn next(&mut self, state: &mut Self::State) -> Result<CorpusId, Error> {
if state.corpus().count() == 0 {
Err(Error::empty(String::from("No entries in corpus")))
Err(Error::empty(String::from("No entries in corpus. This often implies the target is not properly instrumented.")))
} else {
let id = match state.corpus().current() {
Some(cur) => {
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/schedulers/probabilistic_sampling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ where
#[allow(clippy::cast_precision_loss)]
fn next(&mut self, state: &mut Self::State) -> Result<CorpusId, Error> {
if state.corpus().count() == 0 {
Err(Error::empty(String::from("No entries in corpus")))
Err(Error::empty(String::from("No entries in corpus. This often implies the target is not properly instrumented.")))
} else {
let rand_prob: f64 = (state.rand_mut().below(100) as f64) / 100.0;
let meta = state.metadata_map().get::<ProbabilityMetadata>().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/schedulers/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ where
/// Gets the next entry in the queue
fn next(&mut self, state: &mut Self::State) -> Result<CorpusId, Error> {
if state.corpus().count() == 0 {
Err(Error::empty("No entries in corpus".to_owned()))
Err(Error::empty("No entries in corpus. This often implies the target is not properly instrumented.".to_owned()))
} else {
let id = state
.corpus()
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/schedulers/tuneable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ where
/// Gets the next entry in the queue
fn next(&mut self, state: &mut Self::State) -> Result<CorpusId, Error> {
if state.corpus().count() == 0 {
return Err(Error::empty("No entries in corpus".to_owned()));
return Err(Error::empty("No entries in corpus. This often implies the target is not properly instrumented.".to_owned()));
}
let id = if let Some(next) = Self::get_next(state) {
// next was set
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/schedulers/weighted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ where
fn next(&mut self, state: &mut S) -> Result<CorpusId, Error> {
let corpus_counts = state.corpus().count();
if corpus_counts == 0 {
Err(Error::empty(String::from("No entries in corpus")))
Err(Error::empty(String::from("No entries in corpus. This often implies the target is not properly instrumented.")))
} else {
let s = random_corpus_id!(state.corpus(), state.rand_mut());

Expand Down

0 comments on commit 34b4a6a

Please sign in to comment.