Ghidra is a software reverse engineering (SRE) framework
GP-0 Correct EmulatorHelper error handling for NullPointerException (Closes #3139)
ghidra1a5ae2cc04e03
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/EmulatorHelper.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/EmulatorHelper.javaindex 5ac4329e9b..38b461d17e 100644--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/EmulatorHelper.java+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/EmulatorHelper.java@@ -511,6 +511,9 @@ public class EmulatorHelper implements MemoryFaultHandler, EmulatorConfigurationcatch (Throwable t) {// TODO: need to enumerate errors better !!lastError = t.getMessage();+ if (lastError == null) {+ lastError = t.toString();+ }emulator.setHalt(true); // force execution to stopif (t instanceof CancelledException) {throw (CancelledException) t;diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcode/emulate/Emulate.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcode/emulate/Emulate.javaindex 2204e06fd5..97387d9702 100644--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcode/emulate/Emulate.java+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcode/emulate/Emulate.java@@ -377,6 +377,9 @@ public class Emulate {/// completes.public void executeInstruction(boolean stopAtBreakpoint, TaskMonitor monitor)throws CancelledException, LowlevelError, InstructionDecodeException {+ if (monitor == null) {+ monitor = TaskMonitor.DUMMY;+ }if (executionState == EmulateExecutionState.STOPPED) {if (last_execute_address == null && instructionStateModifier != null) {instructionStateModifier.initialExecuteCallback(this, current_address,