Add nullptr check for xpc_connection_t in AuthenticationManager::initializeConnection
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2018 23:57:01 +0000 (23:57 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2018 23:57:01 +0000 (23:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187110
<rdar://problem/41536815>

Reviewed by Brent Fulgham.

In some rare cases as shown by crash tracers that the passed xpc_connection_t object could be nullptr,
and xpc_connection_set_event_handler won't do the nullptr check on its parameters. Therefore, we should
do it by ourselves.

* Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
(WebKit::AuthenticationManager::initializeConnection):
* UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
(WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233340 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm

index cc87df8..ca0456d 100644 (file)
@@ -1,3 +1,20 @@
+2018-06-28  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Add nullptr check for xpc_connection_t in AuthenticationManager::initializeConnection
+        https://bugs.webkit.org/show_bug.cgi?id=187110
+        <rdar://problem/41536815>
+
+        Reviewed by Brent Fulgham.
+
+        In some rare cases as shown by crash tracers that the passed xpc_connection_t object could be nullptr,
+        and xpc_connection_set_event_handler won't do the nullptr check on its parameters. Therefore, we should
+        do it by ourselves.
+
+        * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
+        (WebKit::AuthenticationManager::initializeConnection):
+        * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
+        (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const):
+
 2018-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] DataTransfer.getData always returns the empty string when dropping text
index b86ae8a..6aae205 100644 (file)
@@ -40,7 +40,7 @@ void AuthenticationManager::initializeConnection(IPC::Connection* connection)
 {
     ASSERT(isMainThread());
 
-    if (!connection || xpc_get_type(connection->xpcConnection()) != XPC_TYPE_CONNECTION) {
+    if (!connection || !connection->xpcConnection()) {
         ASSERT_NOT_REACHED();
         return;
     }