mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-10 09:13:58 -09:00
GP-1548: Fixed a bug with recovering Objective-C method names
This commit is contained in:
@@ -39,7 +39,7 @@ public class ObjectiveC2_Class implements StructConverter {
|
||||
private ObjectiveC2_Class superclass;
|
||||
private ObjectiveC2_Cache cache;
|
||||
private ObjectiveC2_Implementation vtable;
|
||||
private ObjectiveC2_ClassRW data;
|
||||
private ObjectiveC2_ClassRW data; // class_rw_t * plus custom rr/alloc flags
|
||||
|
||||
public ObjectiveC2_Class(ObjectiveC2_State state, BinaryReader reader) {
|
||||
this._state = state;
|
||||
@@ -115,6 +115,10 @@ public class ObjectiveC2_Class implements StructConverter {
|
||||
//Trying to read uninitialized memory
|
||||
return;
|
||||
}
|
||||
|
||||
// Fix pointer by applying Swift FAST_DATA_MASK (see objc-runtime-new.h for details)
|
||||
index &= _state.is64bit ? ~0x7L : ~0x3L;
|
||||
|
||||
if (index != 0 && reader.isValidIndex(index)) {
|
||||
long originalIndex = reader.getPointerIndex();
|
||||
reader.setPointerIndex(index);
|
||||
|
||||
@@ -38,7 +38,8 @@ public class ObjectiveC2_Method extends ObjectiveC_Method {
|
||||
if (isSmallList) {
|
||||
int nameOffset = (int)ObjectiveC1_Utilities.readNextIndex(reader, true);
|
||||
int namePtr = reader.readInt(_index + nameOffset);
|
||||
name = reader.readAsciiString(namePtr);
|
||||
long imagebase = state.program.getImageBase().getOffset(); // When we support dyld_shared_cache, this base will likely have to change
|
||||
name = reader.readAsciiString(imagebase + namePtr);
|
||||
|
||||
int typesOffset = (int)ObjectiveC1_Utilities.readNextIndex(reader, true);
|
||||
types = reader.readAsciiString(_index + 4 + typesOffset);
|
||||
|
||||
Reference in New Issue
Block a user