Title: [187490] trunk/Source/WebCore
Revision
187490
Author
[email protected]
Date
2015-07-28 11:11:59 -0700 (Tue, 28 Jul 2015)

Log Message

Handle null CFArrayRef returning from _CFHTTPParsedCookiesWithResponseHeaderFields.
<rdar://problem/21995928> and https://bugs.webkit.org/show_bug.cgi?id=147365

Reviewed by Alexey Proskuryakov.

* platform/network/cf/CookieJarCFNet.cpp:
(WebCore::filterCookies): ASSERT the input is not null.
(WebCore::createCookies): Always return a CFArrayRef, even if it's empty.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (187489 => 187490)


--- trunk/Source/WebCore/ChangeLog	2015-07-28 17:24:26 UTC (rev 187489)
+++ trunk/Source/WebCore/ChangeLog	2015-07-28 18:11:59 UTC (rev 187490)
@@ -1,3 +1,14 @@
+2015-07-28  Brady Eidson  <[email protected]>
+
+        Handle null CFArrayRef returning from _CFHTTPParsedCookiesWithResponseHeaderFields.
+        <rdar://problem/21995928> and https://bugs.webkit.org/show_bug.cgi?id=147365
+
+        Reviewed by Alexey Proskuryakov.
+
+        * platform/network/cf/CookieJarCFNet.cpp:
+        (WebCore::filterCookies): ASSERT the input is not null.
+        (WebCore::createCookies): Always return a CFArrayRef, even if it's empty.
+
 2015-07-28  Chris Dumez  <[email protected]>
 
         Allow lax MIME type parsing for same-origin CSS in quirks mode.

Modified: trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp (187489 => 187490)


--- trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp	2015-07-28 17:24:26 UTC (rev 187489)
+++ trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp	2015-07-28 18:11:59 UTC (rev 187490)
@@ -80,6 +80,7 @@
 
 static RetainPtr<CFArrayRef> filterCookies(CFArrayRef unfilteredCookies)
 {
+    ASSERT(unfilteredCookies);
     CFIndex count = CFArrayGetCount(unfilteredCookies);
     RetainPtr<CFMutableArrayRef> filteredCookies = adoptCF(CFArrayCreateMutable(0, count, &kCFTypeArrayCallBacks));
     for (CFIndex i = 0; i < count; ++i) {
@@ -116,10 +117,14 @@
 static CFArrayRef createCookies(CFDictionaryRef headerFields, CFURLRef url)
 {
 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000)
-    return _CFHTTPParsedCookiesWithResponseHeaderFields(kCFAllocatorDefault, headerFields, url);
+    CFArrayRef parsedCookies = _CFHTTPParsedCookiesWithResponseHeaderFields(kCFAllocatorDefault, headerFields, url);
 #else
-    return CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault, headerFields, url);
+    CFArrayRef parsedCookies = CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault, headerFields, url);
 #endif
+    if (!parsedCookies)
+        parsedCookies = CFArrayCreate(kCFAllocatorDefault, 0, 0, &kCFTypeArrayCallBacks);
+
+    return parsedCookies;
 }
 
 void setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url, const String& value)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to