diff --git a/crashtracker/src/receiver.rs b/crashtracker/src/receiver.rs index 2977dbe83..c92e2cf60 100644 --- a/crashtracker/src/receiver.rs +++ b/crashtracker/src/receiver.rs @@ -82,6 +82,7 @@ enum StdinState { Counters, Done, File(String, Vec), + InternalError(String), Metadata, SigInfo, StackTrace(Vec), @@ -137,6 +138,8 @@ fn process_line( StdinState::File(name, contents) } + StdinState::InternalError(e) => anyhow::bail!("Can't continue after internal error {e}"), + StdinState::Metadata if line.starts_with(DD_CRASHTRACK_END_METADATA) => StdinState::Waiting, StdinState::Metadata => { let metadata = serde_json::from_str(&line)?; @@ -207,7 +210,14 @@ fn receive_report(stream: impl std::io::BufRead) -> anyhow::Result stdin_state = next_state, + Err(e) => { + // If the input is corrupted, stop and salvage what we can + stdin_state = StdinState::InternalError(e.to_string()); + break; + } + } } if !crashinfo.crash_seen() {