From 42ba65e864bb5531c5fc22745994465ba1a35da7 Mon Sep 17 00:00:00 2001 From: Valentin Huber Date: Fri, 6 Dec 2024 18:32:58 +0100 Subject: [PATCH] Fix empty multipart name (#2750) --- libafl/src/inputs/multi.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libafl/src/inputs/multi.rs b/libafl/src/inputs/multi.rs index 7ebdd0f2c5..55353faa4c 100644 --- a/libafl/src/inputs/multi.rs +++ b/libafl/src/inputs/multi.rs @@ -154,12 +154,16 @@ where I: Input, { fn generate_name(&self, id: Option) -> String { - self.names - .iter() - .cloned() - .zip(self.parts.iter().map(|i| i.generate_name(id))) - .map(|(name, generated)| format!("{name}-{generated}")) - .collect::>() - .join(",") + if self.names().len() > 0 { + self.names + .iter() + .cloned() + .zip(self.parts.iter().map(|i| i.generate_name(id))) + .map(|(name, generated)| format!("{name}-{generated}")) + .collect::>() + .join(",") + } else { + "empty_multipart".to_string() // empty strings cause issues with OnDiskCorpus + } } }