mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-27 22:05:50 +08:00
GP-4457: The dyld_shared_cache loader no longer throws an exception when
importing newer versions that use dyld_cache_slide_info5
This commit is contained in:
+3
-1
@@ -408,7 +408,9 @@ public class DyldCacheHeader implements StructConverter {
|
|||||||
DyldCacheSlideInfoCommon slideInfo = DyldCacheSlideInfoCommon.parseSlideInfo(reader,
|
DyldCacheSlideInfoCommon slideInfo = DyldCacheSlideInfoCommon.parseSlideInfo(reader,
|
||||||
info.getSlideInfoFileOffset(), info.getAddress(), info.getSize(),
|
info.getSlideInfoFileOffset(), info.getAddress(), info.getSize(),
|
||||||
info.getFileOffset(), log, monitor);
|
info.getFileOffset(), log, monitor);
|
||||||
slideInfoList.add(slideInfo);
|
if (slideInfo != null) {
|
||||||
|
slideInfoList.add(slideInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -113,7 +113,7 @@ public class DyldCacheSlideInfo4 extends DyldCacheSlideInfoCommon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link DyldCacheSlideInfo3}.
|
* Create a new {@link DyldCacheSlideInfo4}.
|
||||||
*
|
*
|
||||||
* @param reader A {@link BinaryReader} positioned at the start of a DYLD slide info 3
|
* @param reader A {@link BinaryReader} positioned at the start of a DYLD slide info 3
|
||||||
* @param mappingAddress The base address of where the slide fixups will take place
|
* @param mappingAddress The base address of where the slide fixups will take place
|
||||||
|
|||||||
+4
-3
@@ -67,9 +67,11 @@ public abstract class DyldCacheSlideInfoCommon implements StructConverter {
|
|||||||
|
|
||||||
monitor.setMessage("Parsing DYLD slide info...");
|
monitor.setMessage("Parsing DYLD slide info...");
|
||||||
monitor.initialize(1);
|
monitor.initialize(1);
|
||||||
|
String errorMessage = "Failed to parse dyld_cache_slide_info";
|
||||||
try {
|
try {
|
||||||
reader.setPointerIndex(slideInfoOffset);
|
reader.setPointerIndex(slideInfoOffset);
|
||||||
int version = reader.readInt(reader.getPointerIndex());
|
int version = reader.readInt(reader.getPointerIndex());
|
||||||
|
errorMessage += version;
|
||||||
DyldCacheSlideInfoCommon returnedSlideInfo = switch (version) {
|
DyldCacheSlideInfoCommon returnedSlideInfo = switch (version) {
|
||||||
case 1 -> new DyldCacheSlideInfo1(reader, mappingAddress, mappingSize,
|
case 1 -> new DyldCacheSlideInfo1(reader, mappingAddress, mappingSize,
|
||||||
mappingFileOffset);
|
mappingFileOffset);
|
||||||
@@ -79,15 +81,14 @@ public abstract class DyldCacheSlideInfoCommon implements StructConverter {
|
|||||||
mappingFileOffset);
|
mappingFileOffset);
|
||||||
case 4 -> new DyldCacheSlideInfo4(reader, mappingAddress, mappingSize,
|
case 4 -> new DyldCacheSlideInfo4(reader, mappingAddress, mappingSize,
|
||||||
mappingFileOffset);
|
mappingFileOffset);
|
||||||
default -> throw new IOException("Unrecognized slide info version: " + version);
|
default -> throw new IOException(); // will be caught and version will be added to message
|
||||||
};
|
};
|
||||||
monitor.incrementProgress(1);
|
monitor.incrementProgress(1);
|
||||||
returnedSlideInfo.slideInfoOffset = slideInfoOffset;
|
returnedSlideInfo.slideInfoOffset = slideInfoOffset;
|
||||||
return returnedSlideInfo;
|
return returnedSlideInfo;
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
log.appendMsg(DyldCacheSlideInfoCommon.class.getSimpleName(),
|
log.appendMsg(DyldCacheSlideInfoCommon.class.getSimpleName(), errorMessage);
|
||||||
"Failed to parse dyld_cache_slide_info.");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user