Title: [206996] trunk/Source/WebCore
Revision
206996
Author
carlo...@webkit.org
Date
2016-10-10 08:11:11 -0700 (Mon, 10 Oct 2016)

Log Message

REGRESSION(r206731): [SOUP] Network process crash in gotHeadersCallback
https://bugs.webkit.org/show_bug.cgi?id=163170

Reviewed by Michael Catanzaro.

Do not assume NetworkingContext is non-null and valid before using it.

* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::gotHeadersCallback):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (206995 => 206996)


--- trunk/Source/WebCore/ChangeLog	2016-10-10 13:42:24 UTC (rev 206995)
+++ trunk/Source/WebCore/ChangeLog	2016-10-10 15:11:11 UTC (rev 206996)
@@ -1,3 +1,16 @@
+2016-10-10  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        REGRESSION(r206731): [SOUP] Network process crash in gotHeadersCallback
+        https://bugs.webkit.org/show_bug.cgi?id=163170
+
+        Reviewed by Michael Catanzaro.
+
+        Do not assume NetworkingContext is non-null and valid before using it.
+
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::gotHeadersCallback):
+        (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
+
 2016-10-10  Youenn Fablet  <you...@apple.com>
 
         Images and scripts should be said as clean based on CachedResource::isCORSSameOrigin

Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (206995 => 206996)


--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2016-10-10 13:42:24 UTC (rev 206995)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2016-10-10 15:11:11 UTC (rev 206996)
@@ -151,14 +151,16 @@
 
     ResourceHandleInternal* d = handle->getInternal();
 
-    // We are a bit more conservative with the persistent credential storage than the session store,
-    // since we are waiting until we know that this authentication succeeded before actually storing.
-    // This is because we want to avoid hitting the disk twice (once to add and once to remove) for
-    // incorrect credentials or polluting the keychain with invalid credentials.
-    if (!isAuthenticationFailureStatusCode(message->status_code) && message->status_code < 500) {
-        d->m_context->storageSession().saveCredentialToPersistentStorage(
-            d->m_credentialDataToSaveInPersistentStore.protectionSpace,
-            d->m_credentialDataToSaveInPersistentStore.credential);
+    if (d->m_context && d->m_context->isValid()) {
+        // We are a bit more conservative with the persistent credential storage than the session store,
+        // since we are waiting until we know that this authentication succeeded before actually storing.
+        // This is because we want to avoid hitting the disk twice (once to add and once to remove) for
+        // incorrect credentials or polluting the keychain with invalid credentials.
+        if (!isAuthenticationFailureStatusCode(message->status_code) && message->status_code < 500) {
+            d->m_context->storageSession().saveCredentialToPersistentStorage(
+                d->m_credentialDataToSaveInPersistentStore.protectionSpace,
+                d->m_credentialDataToSaveInPersistentStore.credential);
+        }
     }
 
     // The original response will be needed later to feed to willSendRequest in
@@ -830,7 +832,7 @@
     // of all request latency, versus a one-time latency for the small subset of requests that
     // use HTTP authentication. In the end, this doesn't matter much, because persistent credentials
     // will become session credentials after the first use.
-    if (useCredentialStorage) {
+    if (useCredentialStorage && d->m_context && d->m_context->isValid()) {
         d->m_context->storageSession().getCredentialFromPersistentStorage(challenge.protectionSpace(), [this, protectedThis = makeRef(*this)] (Credential&& credential) {
             continueDidReceiveAuthenticationChallenge(WTFMove(credential));
         });
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to