From c8c5d89f336208112ff91889865e6bedb62aa23d Mon Sep 17 00:00:00 2001 From: Arpan Kapoor Date: Wed, 3 May 2023 19:15:27 +0530 Subject: [PATCH] Ignore 'Broken Pipe' if child process does not read all of stdin (#1244) * Ignore 'Broken Pipe' if child process does not read all of stdin * follow clippy suggestion --- libafl/src/executors/command.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libafl/src/executors/command.rs b/libafl/src/executors/command.rs index c97c431754..64bb700581 100644 --- a/libafl/src/executors/command.rs +++ b/libafl/src/executors/command.rs @@ -135,8 +135,15 @@ impl CommandConfigurator for StdCommandConfigurator { self.command.stdin(Stdio::piped()).spawn()?; let mut handle = self.command.spawn()?; let mut stdin = handle.stdin.take().unwrap(); - stdin.write_all(input.target_bytes().as_slice())?; - stdin.flush()?; + if let Err(err) = stdin.write_all(input.target_bytes().as_slice()) { + if err.kind() != std::io::ErrorKind::BrokenPipe { + return Err(err.into()); + } + } else if let Err(err) = stdin.flush() { + if err.kind() != std::io::ErrorKind::BrokenPipe { + return Err(err.into()); + } + } drop(stdin); Ok(handle) }