Bug 147365 - Handle null CFArrayRef returning from _CFHTTPParsedCookiesWithResponseHeaderFields
Summary: Handle null CFArrayRef returning from _CFHTTPParsedCookiesWithResponseHeaderF...
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-28 11:02 PDT by Brady Eidson
Modified: 2022-10-05 15:10 PDT (History)
3 users (show)

See Also:


Attachments
Patch v1 (2.34 KB, patch)
2015-07-28 11:06 PDT, Brady Eidson
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2015-07-28 11:02:46 PDT
Handle null CFArrayRef returning from _CFHTTPParsedCookiesWithResponseHeaderFields

Per CF API naming conventions, this SPI is allowed to return null, and it sometimes does.

Properly handle he null check so our "createCookies" function never returns null.

<rdar://problem/21995928>
Comment 1 Brady Eidson 2015-07-28 11:06:57 PDT
Created attachment 257661 [details]
Patch v1
Comment 2 Brady Eidson 2015-07-28 11:13:52 PDT
https://trac.webkit.org/changeset/187490
Comment 3 Darin Adler 2015-07-28 11:24:23 PDT
Comment on attachment 257661 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=257661&action=review

> Source/WebCore/platform/network/cf/CookieJarCFNet.cpp:117
>  static CFArrayRef createCookies(CFDictionaryRef headerFields, CFURLRef url)

Peculiar that this one function returns CFArrayRef rather than RetainPtr<CFArrayRef>, when all the rest in the file use RetainPtr. I think we should come back here and change it.

> Source/WebCore/platform/network/cf/CookieJarCFNet.cpp:125
> +        parsedCookies = CFArrayCreate(kCFAllocatorDefault, 0, 0, &kCFTypeArrayCallBacks);

Too bad there is no CF equivalent to @[], annoying to create a new array every time, although not a real problem.
Comment 4 Ahmad Saleem 2022-10-05 15:09:49 PDT
CookieJarCFNet.cpp is no more in same shape or form but we still have following:

https://github.com/WebKit/WebKit/blob/a2db53cd97dc8136ac5c2a22d4cd2b53d0d717d6/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNetWin.cpp#L228


and this ASSERT already added:

https://github.com/WebKit/WebKit/blob/a2db53cd97dc8136ac5c2a22d4cd2b53d0d717d6/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNetWin.cpp#L181

Do we need anything from this patch or we can close this? Thanks!