Ghidra is a software reverse engineering (SRE) framework
GP-3373 fix 'Analyze All Open' when there is a nullable option value
dev747368c2e427e3e99a
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisPanel.javaindex 3cd46f7891..014fb0a9c3 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisPanel.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisPanel.java@@ -580,17 +580,27 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {}private void copyOptionsTo(Program program) {- Options destinationOptions = program.getOptions(Program.ANALYSIS_PROPERTIES);- // first remove all options in destination- for (String optionName : destinationOptions.getOptionNames()) {- destinationOptions.removeOption(optionName);- }+ // fetching the autoAnalysisManager for the program here allows analyzers to register their+ // options in that program's db.+ AutoAnalysisManager aam = AutoAnalysisManager.getAnalysisManager(program);++ Options destinationOptions = program.getOptions(Program.ANALYSIS_PROPERTIES);- // now copy all the options in the source+ // copy the analyzer options (at the db level)for (String optionName : analysisOptions.getOptionNames()) {- destinationOptions.putObject(optionName, analysisOptions.getObject(optionName, null));+ Object optionValue = analysisOptions.getObject(optionName, null);+ if (optionValue == null && !destinationOptions.isRegistered(optionName)) {+ Msg.warn(this, "Unable to copy null option %s to program %s".formatted(optionName,+ program.getName()));+ }+ else {+ destinationOptions.putObject(optionName, optionValue);+ }}++ // update the analyzers on the program with new option values+ aam.initializeOptions(analysisOptions);}private void replaceOldOptions() {