Fix crash when during canAuthenticateAgainstProtectionSpace
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Jan 2018 21:58:31 +0000 (21:58 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Jan 2018 21:58:31 +0000 (21:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182260
<rdar://problem/34911343>

Reviewed by Chris Dumez.

If we have a valid network load with no challenge completion handler and we are
telling it to continue with the challenge handling, something has gone wrong.
Maybe we've just recovered from a crashed network process.  If this happens, do nothing.

* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):

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

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkLoad.cpp

index f991b2d..280f1fb 100644 (file)
@@ -1,3 +1,18 @@
+2018-01-29  Alex Christensen  <achristensen@webkit.org>
+
+        Fix crash when during canAuthenticateAgainstProtectionSpace
+        https://bugs.webkit.org/show_bug.cgi?id=182260
+        <rdar://problem/34911343>
+
+        Reviewed by Chris Dumez.
+
+        If we have a valid network load with no challenge completion handler and we are
+        telling it to continue with the challenge handling, something has gone wrong.
+        Maybe we've just recovered from a crashed network process.  If this happens, do nothing.
+
+        * NetworkProcess/NetworkLoad.cpp:
+        (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
+
 2018-01-29  Zach Li  <zacharyli323@gmail.com>
 
         Warning in 32-bit WebKit build when trying to link to SafariSafeBrowsing
index 158e5cf..d0634ac 100644 (file)
@@ -296,7 +296,11 @@ void NetworkLoad::completeAuthenticationChallenge(ChallengeCompletionHandler&& c
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
 void NetworkLoad::continueCanAuthenticateAgainstProtectionSpace(bool result)
 {
-    ASSERT(m_challengeCompletionHandler);
+    if (!m_challengeCompletionHandler) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
     auto completionHandler = std::exchange(m_challengeCompletionHandler, nullptr);
     if (!result) {
         if (NetworkSession::allowsSpecificHTTPSCertificateForHost(*m_challenge))