Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-2802: Fixed an issue that prevented some Mach-O binaries from being imported if there were unexpected issues while creating the Program Tree.

Ryan Kurtz924f84b3c32d
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java
index e6bbe16480..4b84f81733 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java
@@ -427,8 +427,18 @@ public class MachoProgramBuilder {
break;
}
}
+ if (segmentFragment == null) {
+ log.appendMsg("Could not find/fixup segment in Program Tree: " + segmentName);
+ continue;
+ }
ProgramModule segmentModule = rootModule.createModule(segmentName);
- segmentModule.reparent(noSectionsName, rootModule);
+ try {
+ segmentModule.reparent(noSectionsName, rootModule);
+ }
+ catch (NotFoundException e) {
+ log.appendException(e);
+ continue;
+ }
// Add the sections, which will remove overlapped ranges from the segment fragment
for (Section section : segment.getSections()) {