Unverified Commit d9750edc by Melvin Klimke Committed by GitHub

Prevent infinite loop if Ghidra crashes (#188)

parent 46af37e8
......@@ -277,6 +277,22 @@ fn get_project_from_ghidra(file_path: &Path, binary: &[u8]) -> (Project, Vec<Log
}
};
match String::from_utf8(output.stdout.clone()) {
Ok(standard_out) => {
if !standard_out.contains("Pcode was successfully extracted!") {
eprintln!("Execution of Ghidra plugin failed: Process was terminated.");
let error_message: String =
standard_out.lines().rev().collect::<Vec<&str>>()[..2].join("\n");
eprintln!("{}", error_message);
std::process::exit(101);
}
}
Err(_) => {
eprintln!("Execution of Ghidra plugin failed: Process was terminated.");
std::process::exit(101);
}
}
if !output.status.success() {
match output.status.code() {
Some(code) => {
......
......@@ -58,6 +58,7 @@ public class PcodeExtractor extends GhidraScript {
Serializer ser = new Serializer(project, jsonPath);
ser.serializeProject();
println("Pcode was successfully extracted!");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment