Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
handle non-utf8 from libfuzzer stderr (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmc-msft authored Dec 10, 2020
1 parent 56090cb commit 7f5673e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/agent/onefuzz-agent/src/tasks/fuzz/libfuzzer_fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,16 @@ impl LibFuzzerFuzzTask {
.stderr
.as_mut()
.ok_or_else(|| format_err!("stderr not captured"))?;
let stderr = BufReader::new(stderr);
let mut stderr = BufReader::new(stderr);

let mut libfuzzer_output = Vec::new();
let mut lines = stderr.lines();
while let Some(line) = lines.next_line().await? {
loop {
let mut buf = vec![];
let bytes_read = stderr.read_until(b'\n', &mut buf).await?;
if bytes_read == 0 && buf.is_empty() {
break;
}
let line = String::from_utf8_lossy(&buf).to_string();
if let Some(stats_sender) = stats_sender {
if let Err(err) = try_report_iter_update(stats_sender, worker_id, run_id, &line) {
error!("could not parse fuzzing interation update: {}", err);
Expand Down

0 comments on commit 7f5673e

Please sign in to comment.