don't remove all items from corpus
This commit is contained in:
parent
0e7de2d109
commit
7c71e683d8
@ -98,7 +98,7 @@ where
|
|||||||
{
|
{
|
||||||
const PRUNE_THRESHOLD: usize = 200;
|
const PRUNE_THRESHOLD: usize = 200;
|
||||||
if state.corpus().count() > PRUNE_THRESHOLD*vc {
|
if state.corpus().count() > PRUNE_THRESHOLD*vc {
|
||||||
println!("Pruning corpus, keeping {} / {}", PRUNE_THRESHOLD*vc, state.corpus().count());
|
println!("Pruning corpus, keeping {} / {}", usize::max(1,vc)*PRUNE_THRESHOLD/2, state.corpus().count());
|
||||||
let corpus = state.corpus_mut();
|
let corpus = state.corpus_mut();
|
||||||
let currid = corpus.current();
|
let currid = corpus.current();
|
||||||
let ids : Vec<_> = corpus.ids().filter_map(|x| {
|
let ids : Vec<_> = corpus.ids().filter_map(|x| {
|
||||||
@ -109,7 +109,7 @@ where
|
|||||||
} else {
|
} else {
|
||||||
Some((x, tc.exec_time().clone()))
|
Some((x, tc.exec_time().clone()))
|
||||||
}
|
}
|
||||||
}).sorted_by_key(|x| x.1).take(usize::saturating_sub(corpus.count(),(PRUNE_THRESHOLD/2)*vc)).sorted_by_key(|x| x.0).unique().rev().collect();
|
}).sorted_by_key(|x| x.1).take(usize::saturating_sub(corpus.count(),usize::max(1,vc)*PRUNE_THRESHOLD/2)).sorted_by_key(|x| x.0).unique().rev().collect();
|
||||||
for (cid, _) in ids {
|
for (cid, _) in ids {
|
||||||
let c = state.corpus_mut().remove(cid).unwrap();
|
let c = state.corpus_mut().remove(cid).unwrap();
|
||||||
fuzzer
|
fuzzer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user