Fix crossover mutators for empty multipart inputs (#2663)

This commit is contained in:
Valentin Huber 2024-11-05 14:45:56 +01:00 committed by GitHub
parent 87e4a845e0
commit 4431f069e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -135,6 +135,9 @@ where
let id = random_corpus_id!(state.corpus(), state.rand_mut()); let id = random_corpus_id!(state.corpus(), state.rand_mut());
if let Some(cur) = state.corpus().current() { if let Some(cur) = state.corpus().current() {
if id == *cur { if id == *cur {
if input.names().is_empty() {
return Ok(MutationResult::Skipped);
}
let choice = name_choice % input.names().len(); let choice = name_choice % input.names().len();
let name = input.names()[choice].clone(); let name = input.names()[choice].clone();
@ -264,6 +267,9 @@ where
let id = random_corpus_id!(state.corpus(), state.rand_mut()); let id = random_corpus_id!(state.corpus(), state.rand_mut());
if let Some(cur) = state.corpus().current() { if let Some(cur) = state.corpus().current() {
if id == *cur { if id == *cur {
if input.names().is_empty() {
return Ok(MutationResult::Skipped);
}
let choice = name_choice % input.names().len(); let choice = name_choice % input.names().len();
let name = input.names()[choice].clone(); let name = input.names()[choice].clone();