Title: [236556] trunk/Source/WebCore
Revision
236556
Author
[email protected]
Date
2018-09-27 10:06:26 -0700 (Thu, 27 Sep 2018)

Log Message

Crash under WebCore::deleteCookiesForHostnames()
https://bugs.webkit.org/show_bug.cgi?id=190040
<rdar://problem/38020368>

Reviewed by Alex Christensen.

Update NetworkStorageSession::deleteCookiesForHostnames() to properly deal with the fact
that NSHTTPCookie.domain can return nil.

* platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::NetworkStorageSession::deleteCookiesForHostnames):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (236555 => 236556)


--- trunk/Source/WebCore/ChangeLog	2018-09-27 17:03:45 UTC (rev 236555)
+++ trunk/Source/WebCore/ChangeLog	2018-09-27 17:06:26 UTC (rev 236556)
@@ -1,3 +1,17 @@
+2018-09-27  Chris Dumez  <[email protected]>
+
+        Crash under WebCore::deleteCookiesForHostnames()
+        https://bugs.webkit.org/show_bug.cgi?id=190040
+        <rdar://problem/38020368>
+
+        Reviewed by Alex Christensen.
+
+        Update NetworkStorageSession::deleteCookiesForHostnames() to properly deal with the fact
+        that NSHTTPCookie.domain can return nil.
+
+        * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+        (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
+
 2018-09-27  Youenn Fablet  <[email protected]>
 
         Use kCVPixelFormatType_420YpCbCr8Planar for capturing frames

Modified: trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (236555 => 236556)


--- trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm	2018-09-27 17:03:45 UTC (rev 236555)
+++ trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm	2018-09-27 17:06:26 UTC (rev 236556)
@@ -508,9 +508,12 @@
         return;
 
     HashMap<String, Vector<RetainPtr<NSHTTPCookie>>> cookiesByDomain;
-    for (NSHTTPCookie* cookie in cookies) {
-        auto& cookies = cookiesByDomain.add(cookie.domain, Vector<RetainPtr<NSHTTPCookie>>()).iterator->value;
-        cookies.append(cookie);
+    for (NSHTTPCookie *cookie in cookies) {
+        if (!cookie.domain)
+            continue;
+        cookiesByDomain.ensure(cookie.domain, [] {
+            return Vector<RetainPtr<NSHTTPCookie>>();
+        }).iterator->value.append(cookie);
     }
 
     for (const auto& hostname : hostnames) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to