diff --git a/Demo/SwiftDump b/Demo/SwiftDump index f49312c..ee03666 100755 Binary files a/Demo/SwiftDump and b/Demo/SwiftDump differ diff --git a/SwiftDump/SwiftDump/SDParser.swift b/SwiftDump/SwiftDump/SDParser.swift index 4926e3c..4d15153 100644 --- a/SwiftDump/SwiftDump/SDParser.swift +++ b/SwiftDump/SwiftDump/SDParser.swift @@ -627,11 +627,19 @@ func dumpFieldDescriptor(loader: SDFileLoader, fieldDescriptorPtr: SDPointer, to let typeNamePtr = loader.readMove(fieldAddr.add(4)).fix(); let typeName = loader.readStr(typeNamePtr); + if let type = typeName, (type.count <= 0 || type.count > 100) { + continue + } + let fieldNamePtr = loader.readMove(fieldAddr.add(8)).fix(); let fieldName = loader.readStr(fieldNamePtr); + if let field = fieldName, (field.count <= 0 || field.count > 100) { + continue + } if let type = typeName, let field = fieldName { + let realType = getTypeFromMangledName(type); let fieldObj = SDNominalObjField(); fieldObj.name = field; // name: field, type: realType diff --git a/SwiftDump/SwiftDump/Util/Ext.swift b/SwiftDump/SwiftDump/Util/Ext.swift index e609a8a..ff337ad 100644 --- a/SwiftDump/SwiftDump/Util/Ext.swift +++ b/SwiftDump/SwiftDump/Util/Ext.swift @@ -152,6 +152,10 @@ extension Data { } } + if (result.count > 10000) { + return nil + } + let tmp = result.reduce("0x") { (result, val:UInt8) -> String in return result + String(format: "%02x", val); } diff --git a/SwiftDump/SwiftDump/Util/RuntimeBridge.swift b/SwiftDump/SwiftDump/Util/RuntimeBridge.swift index 582ac03..8abd72b 100644 --- a/SwiftDump/SwiftDump/Util/RuntimeBridge.swift +++ b/SwiftDump/SwiftDump/Util/RuntimeBridge.swift @@ -69,7 +69,13 @@ func getTypeFromMangledName(_ str: String) -> String { guard let ptr = str.toPointer() else { return str; } - guard let typeRet: Any.Type = _getTypeByMangledNameInContext(ptr, str.count, genericContext: nil, genericArguments: nil) else { + + var useCnt:Int = str.count + if (str.hasSuffix("_pG")) { + useCnt = useCnt - 3 + } + + guard let typeRet: Any.Type = _getTypeByMangledNameInContext(ptr, useCnt, genericContext: nil, genericArguments: nil) else { return str; }