From 4431f069e5a2a541d11f010c6b8da3b8b53c4e8f Mon Sep 17 00:00:00 2001 From: Valentin Huber Date: Tue, 5 Nov 2024 14:45:56 +0100 Subject: [PATCH] Fix crossover mutators for empty multipart inputs (#2663) --- libafl/src/mutators/multi.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libafl/src/mutators/multi.rs b/libafl/src/mutators/multi.rs index ed09bfbe26..032e35433c 100644 --- a/libafl/src/mutators/multi.rs +++ b/libafl/src/mutators/multi.rs @@ -135,6 +135,9 @@ where let id = random_corpus_id!(state.corpus(), state.rand_mut()); if let Some(cur) = state.corpus().current() { if id == *cur { + if input.names().is_empty() { + return Ok(MutationResult::Skipped); + } let choice = name_choice % input.names().len(); let name = input.names()[choice].clone(); @@ -264,6 +267,9 @@ where let id = random_corpus_id!(state.corpus(), state.rand_mut()); if let Some(cur) = state.corpus().current() { if id == *cur { + if input.names().is_empty() { + return Ok(MutationResult::Skipped); + } let choice = name_choice % input.names().len(); let name = input.names()[choice].clone();