mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-21 08:31:36 +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,
|
||||
info.getSlideInfoFileOffset(), info.getAddress(), info.getSize(),
|
||||
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 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.initialize(1);
|
||||
String errorMessage = "Failed to parse dyld_cache_slide_info";
|
||||
try {
|
||||
reader.setPointerIndex(slideInfoOffset);
|
||||
int version = reader.readInt(reader.getPointerIndex());
|
||||
errorMessage += version;
|
||||
DyldCacheSlideInfoCommon returnedSlideInfo = switch (version) {
|
||||
case 1 -> new DyldCacheSlideInfo1(reader, mappingAddress, mappingSize,
|
||||
mappingFileOffset);
|
||||
@@ -79,15 +81,14 @@ public abstract class DyldCacheSlideInfoCommon implements StructConverter {
|
||||
mappingFileOffset);
|
||||
case 4 -> new DyldCacheSlideInfo4(reader, mappingAddress, mappingSize,
|
||||
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);
|
||||
returnedSlideInfo.slideInfoOffset = slideInfoOffset;
|
||||
return returnedSlideInfo;
|
||||
}
|
||||
catch (IOException e) {
|
||||
log.appendMsg(DyldCacheSlideInfoCommon.class.getSimpleName(),
|
||||
"Failed to parse dyld_cache_slide_info.");
|
||||
log.appendMsg(DyldCacheSlideInfoCommon.class.getSimpleName(), errorMessage);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user