mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-1675: Sorting PRELINK Mach-O files before processing them
This commit is contained in:
@@ -182,6 +182,7 @@ public class MachoPrelinkProgramBuilder extends MachoProgramBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Process each PRELINK Mach-O
|
// Process each PRELINK Mach-O
|
||||||
|
Collections.sort(prelinkMachoInfoList);
|
||||||
monitor.initialize(prelinkMachoInfoList.size());
|
monitor.initialize(prelinkMachoInfoList.size());
|
||||||
for (int i = 0; i < prelinkMachoInfoList.size(); i++) {
|
for (int i = 0; i < prelinkMachoInfoList.size(); i++) {
|
||||||
PrelinkMachoInfo info = prelinkMachoInfoList.get(i);
|
PrelinkMachoInfo info = prelinkMachoInfoList.get(i);
|
||||||
@@ -192,7 +193,7 @@ public class MachoPrelinkProgramBuilder extends MachoProgramBuilder {
|
|||||||
|
|
||||||
info.processMemoryBlocks();
|
info.processMemoryBlocks();
|
||||||
info.markupHeaders();
|
info.markupHeaders();
|
||||||
info.addToProgramTree(next);
|
info.addToProgramTree(next); // assumes list is sorted
|
||||||
|
|
||||||
monitor.incrementProgress(1);
|
monitor.incrementProgress(1);
|
||||||
}
|
}
|
||||||
@@ -533,7 +534,7 @@ public class MachoPrelinkProgramBuilder extends MachoProgramBuilder {
|
|||||||
/**
|
/**
|
||||||
* Convenience class to store information we need about an individual PRELINK Mach-O.
|
* Convenience class to store information we need about an individual PRELINK Mach-O.
|
||||||
*/
|
*/
|
||||||
private class PrelinkMachoInfo {
|
private class PrelinkMachoInfo implements Comparable<PrelinkMachoInfo> {
|
||||||
|
|
||||||
private Address headerAddr;
|
private Address headerAddr;
|
||||||
private MachHeader header;
|
private MachHeader header;
|
||||||
@@ -621,5 +622,10 @@ public class MachoPrelinkProgramBuilder extends MachoProgramBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(PrelinkMachoInfo o) {
|
||||||
|
return headerAddr.compareTo(o.headerAddr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user