mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-10-22 21:21:02 +00:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
20702592dd
|
@ -244,22 +244,25 @@ public class MachoPrelinkUtils {
|
|||
* @param offset The offset within the provider to check.
|
||||
* @return True A valid {@link LoadSpec} for the Mach-O at the given provider's offset, or null
|
||||
* if it is not a Mach-O or a valid {@link LoadSpec} could not be found.
|
||||
* @throws IOException if there was an IO-related problem.
|
||||
*/
|
||||
private static LoadSpec getMachoLoadSpec(ByteProvider provider, long offset)
|
||||
throws IOException {
|
||||
Collection<LoadSpec> loadSpecs = new MachoLoader().findSupportedLoadSpecs(
|
||||
new ByteProviderWrapper(provider, offset, provider.length() - offset));
|
||||
private static LoadSpec getMachoLoadSpec(ByteProvider provider, long offset) {
|
||||
try {
|
||||
Collection<LoadSpec> loadSpecs = new MachoLoader().findSupportedLoadSpecs(
|
||||
new ByteProviderWrapper(provider, offset, provider.length() - offset));
|
||||
|
||||
// Getting a LoadSpec back means it's a Mach-O we can load. We also need to make sure
|
||||
// the LoadSpec has a language/compiler spec defined to know we support the processor the
|
||||
// loader detected.
|
||||
if (!loadSpecs.isEmpty()) {
|
||||
LoadSpec loadSpec = loadSpecs.iterator().next();
|
||||
if (loadSpec.getLanguageCompilerSpec() != null) {
|
||||
return loadSpec;
|
||||
// Getting a LoadSpec back means it's a Mach-O we can load. We also need to make sure
|
||||
// the LoadSpec has a language/compiler spec defined to know we support the processor the
|
||||
// loader detected.
|
||||
if (!loadSpecs.isEmpty()) {
|
||||
LoadSpec loadSpec = loadSpecs.iterator().next();
|
||||
if (loadSpec.getLanguageCompilerSpec() != null) {
|
||||
return loadSpec;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -412,7 +412,9 @@ public class MachoProgramBuilder {
|
|||
}
|
||||
}
|
||||
if (segmentFragment == null) {
|
||||
log.appendMsg("Could not find/fixup segment in Program Tree: " + segmentName);
|
||||
if (segment.getVMsize() != 0 || segment.getFileSize() != 0) {
|
||||
log.appendMsg("Could not find/fixup segment in Program Tree: " + segmentName);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
ProgramModule segmentModule = rootModule.createModule(segmentName + suffix);
|
||||
|
@ -830,8 +832,10 @@ public class MachoProgramBuilder {
|
|||
List<DyldChainedFixupsCommand> loadCommands =
|
||||
machoHeader.getLoadCommands(DyldChainedFixupsCommand.class);
|
||||
if (!loadCommands.isEmpty()) {
|
||||
BinaryReader memReader = new BinaryReader(new MemoryByteProvider(memory, imagebase),
|
||||
!memory.isBigEndian());
|
||||
for (DyldChainedFixupsCommand loadCommand : loadCommands) {
|
||||
fixups.addAll(loadCommand.getChainedFixups(reader, imagebase.getOffset(),
|
||||
fixups.addAll(loadCommand.getChainedFixups(memReader, imagebase.getOffset(),
|
||||
symbolTable, log, monitor));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user