@@ -1834,13 +1834,21 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
18341834 Ref<Platform> platform = m_plat ? m_plat : g_machoViewType->GetPlatform (0 , m_arch);
18351835
18361836 bool parseObjCStructs = true ;
1837+ bool parseCFStrings = true ;
18371838 if (settings && settings->Contains (" loader.macho.processObjectiveC" ))
18381839 parseObjCStructs = settings->Get <bool >(" loader.macho.processObjectiveC" , this );
1840+ if (settings && settings->Contains (" loader.macho.processCFStrings" ))
1841+ parseCFStrings = settings->Get <bool >(" loader.macho.processCFStrings" , this );
18391842 if (!ObjCProcessor::ViewHasObjCMetadata (this ))
18401843 parseObjCStructs = false ;
1841- if (parseObjCStructs)
1844+ if (!GetSectionByName (" __cfstring" ))
1845+ parseCFStrings = false ;
1846+ if (parseObjCStructs || parseCFStrings)
18421847 {
18431848 m_objcProcessor = new ObjCProcessor (this , m_backedByDatabase);
1849+ }
1850+ if (parseObjCStructs)
1851+ {
18441852
18451853 if (!settings) // Add our defaults
18461854 {
@@ -2297,6 +2305,18 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
22972305 }
22982306 }
22992307
2308+ if (parseCFStrings)
2309+ {
2310+ try {
2311+ m_objcProcessor->ProcessCFStrings ();
2312+ }
2313+ catch (std::exception& ex)
2314+ {
2315+ m_logger->LogError (" Failed to process CFStrings. Binary may be malformed" );
2316+ m_logger->LogError (" Error: %s" , ex.what ());
2317+ }
2318+ }
2319+
23002320 if (parseObjCStructs)
23012321 {
23022322 try {
@@ -3632,6 +3652,16 @@ Ref<Settings> MachoViewType::GetLoadSettingsForData(BinaryView* data)
36323652 programSettings->Set (" workflows.functionWorkflow" , " core.function.objectiveC" , viewRef);
36333653 }
36343654 }
3655+ if (viewRef->GetSectionByName (" __cfstring" ))
3656+ {
3657+ settings->RegisterSetting (" loader.macho.processCFStrings" ,
3658+ R"( {
3659+ "title" : "Process CFString Metadata",
3660+ "type" : "boolean",
3661+ "default" : true,
3662+ "description" : "Processes CoreFoundation strings, applying string values from encoded metadata"
3663+ })" );
3664+ }
36353665
36363666 // register additional settings
36373667 settings->RegisterSetting (" loader.macho.processFunctionStarts" ,
0 commit comments