From 280322cbe02efb5ee1971cb3587aa24f02a76423 Mon Sep 17 00:00:00 2001 From: Ryan Kurtz Date: Thu, 20 Apr 2023 07:32:59 -0400 Subject: [PATCH] GP-2602: Improving ExternalSymbolResolverAnalyzer.canAnalyze() check --- .../core/analysis/ExternalSymbolResolverAnalyzer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ExternalSymbolResolverAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ExternalSymbolResolverAnalyzer.java index 2acde58961..4533c86caa 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ExternalSymbolResolverAnalyzer.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ExternalSymbolResolverAnalyzer.java @@ -44,7 +44,7 @@ public class ExternalSymbolResolverAnalyzer extends AbstractAnalyzer { "Links unresolved external symbols to the first symbol found in the program's required libraries list (found in program properties)."; /** - * Creates a new {@link MachoFunctionStartsAnalyzer} + * Creates a new {@link ExternalSymbolResolverAnalyzer} */ public ExternalSymbolResolverAnalyzer() { super(NAME, DESCRIPTION, AnalyzerType.BYTE_ANALYZER); @@ -57,6 +57,11 @@ public class ExternalSymbolResolverAnalyzer extends AbstractAnalyzer { @Override public boolean canAnalyze(Program program) { + // This analyzer needs to look around the project for imported libraries + if (program.getDomainFile().getParent() == null) { + return false; + } + Options options = program.getOptions(Program.PROGRAM_INFO); String format = options.getString("Executable Format", null); return ElfLoader.ELF_NAME.equals(format) || MachoLoader.MACH_O_NAME.equals(format);