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

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

merged 2 commits into from
May 3, 2023

Conversation

arpankapoor
Copy link
Contributor

Avoid the fuzzer from getting killed if the child process closes the other end of the pipe before the fuzzer has finished writing to it.
I'm not sure if this is an idiomatic way to do this or if this signal should be handled at the global level.

@domenukk
Copy link
Member

domenukk commented May 3, 2023

Looks good thanks!
One thing, clippy suggets to remove one bracket:

error: this `else { if .. }` block can be collapsed
   --> libafl/src/executors/command.rs:142:24
    |
142 |                   } else {
    |  ________________________^
143 | |                     if let Err(err) = stdin.flush() {
144 | |                         if err.kind() != std::io::ErrorKind::BrokenPipe {
145 | |                             return Err(err.into());
146 | |                         }
147 | |                     }
148 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
note: the lint level is defined here
   --> libafl/src/lib.rs:16:9
    |
16  | #![deny(clippy::all)]
    |         ^^^^^^^^^^^
    = note: `#[deny(clippy::collapsible_else_if)]` implied by `#[deny(clippy::all)]`
help: collapse nested if block
    |
142 ~                 } else if let Err(err) = stdin.flush() {
143 +                     if err.kind() != std::io::ErrorKind::BrokenPipe {
144 +                         return Err(err.into());
145 +                     }
146 +                 }
    |

@domenukk
Copy link
Member

domenukk commented May 3, 2023

Thanks! :)

@domenukk domenukk merged commit c8c5d89 into AFLplusplus:main May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants