Ghidra is a software reverse engineering (SRE) framework
GP-4695: Fixed an issue with importing Mach-O binaries that have an empty "__chain_starts" section
Ryan Kurtz1087a923b165
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.javaindex d57a7df6fa..deab619cf5 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@@ -842,7 +842,8 @@ public class MachoProgramBuilder {Section threadStartsSection =machoHeader.getSection(SegmentNames.SEG_TEXT, SectionNames.THREAD_STARTS);- if (chainStartsSection != null) {+ if (chainStartsSection != null && chainStartsSection.getAddress() != 0 &&+ chainStartsSection.getSize() != 0) {reader.setPointerIndex(chainStartsSection.getOffset());DyldChainedStartsOffsets chainedStartsOffsets =new DyldChainedStartsOffsets(reader);@@ -852,7 +853,8 @@ public class MachoProgramBuilder {imagebase.getOffset(), symbolTable, log, monitor));}}- else if (threadStartsSection != null) {+ else if (threadStartsSection != null && threadStartsSection.getAddress() != 0 &&+ threadStartsSection.getSize() != 0) {Address threadSectionStart = space.getAddress(threadStartsSection.getAddress());Address threadSectionEnd =threadSectionStart.add(threadStartsSection.getSize() - 1);