Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore 'Broken Pipe' if child process does not read all of stdin #1244

Merged
merged 2 commits into from
May 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions libafl/src/executors/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down