FB12755685
Sent a feedback through feedback assistant and wanted to elaborate more over here.
Our application configures and connects to wireless networks using CoreWLAN. We started seeing crashes while connecting with the latest Beta versions of Sonoma. The crashes showed EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) which led me to believe it might be a CPU architecture issue due to the mention of i386 but that was completely wrong.
Turns out the error is due to:
*** CFRetain() called with NULL ***
CFRetain.cold.1
[CWInterface associateToEnterpriseNetwork:identity:username:password:error:] + 127
Sample code to consistently reproduce the crash on Sonoma
CWInterface* interface = [CWInterface interfaceWithName:@“en0”];
NSError *scanError = nil;
NSSet* testNetworks = [interface scanForNetworksWithName:@“SSIDName” error:&testScanError];
CWNetwork* network = [testNetworks anyObject];
NSError* connectionError = nil;
BOOL connected = [interface associateToEnterpriseNetwork:network identity:identityRef username:nil password:nil error:&connectionError]; //<--crash here
The associateToEnterpriseNetwork function expects a CWNetwork object. In the Beta versions of macOS Sonoma, the CWNetwork object has (null) values in the ssid field. This causes a cold CFRetain runtime error when trying to associate to the network. If we can detect a broadcasting "SSIDName" SSID and try to associate to it, we will always crash on the last line.
The reason for the crash seems to be due to a difference in how the CWNetwork objects are handled in Sonoma.
Sonoma:
<CWNetwork: 0x6000036cb590> [ssid=(null), bssid=(null), security=WPA2 Enterprise, rssi=-53, channel=<CWChannel: 0x6000036fce90> [channelNumber=1(2GHz), channelWidth={20MHz}], ibss=0]
Ventura:
<CWNetwork: 0x6000010ffa60> [ssid=Chris640, bssid=(null), security=WPA2 Enterprise, rssi=-45, channel=<CWChannel: 0x6000010ffca0> [channelNumber=1(2GHz), channelWidth={20MHz}], ibss=0]
Is my assumption that the crash is due to the (null) in the SSID field correct?