Bug 209994

Summary: [iOS] WebPageProxy::didCommitLoadForFrame should not crash with null or empty `mimeType` parameter
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: WebKit2Assignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, cdumez, darin, thorton, useafterfree, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch v1
none
Patch v2 none

Description David Kilzer (:ddkilzer) 2020-04-03 17:58:04 PDT
WebPageProxy::didCommitLoadForFrame should validate its `mimeType` parameter.

<rdar://problem/60068700>
Comment 1 David Kilzer (:ddkilzer) 2020-04-03 18:00:32 PDT
Created attachment 395423 [details]
Patch v1
Comment 2 David Kilzer (:ddkilzer) 2020-04-03 18:58:03 PDT
Looks like the mimeType parameter can be nil (nullptr) with these tests:

TestWebKitAPI.WebKit.PendingAPIRequestURL
TestWebKitAPI.WebKit.LoadDataWithNilMIMEType
Comment 3 David Kilzer (:ddkilzer) 2020-04-04 06:10:37 PDT
(In reply to David Kilzer (:ddkilzer) from comment #2)
> Looks like the mimeType parameter can be nil (nullptr) with these tests:
> 
> TestWebKitAPI.WebKit.PendingAPIRequestURL
> TestWebKitAPI.WebKit.LoadDataWithNilMIMEType

The api-ios bot only shows this test failing:

TestWebKitAPI.WebKit.LoadDataWithNilMIMEType
Comment 4 David Kilzer (:ddkilzer) 2020-04-07 15:33:02 PDT
Created attachment 395751 [details]
Patch v2
Comment 5 EWS 2020-04-08 10:51:18 PDT
Committed r259729: <https://trac.webkit.org/changeset/259729>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 395751 [details].
Comment 6 Darin Adler 2020-04-08 11:49:38 PDT
Comment on attachment 395751 [details]
Patch v2

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

> Source/WebKit/UIProcess/mac/PageClientImplMac.mm:283
> +    UNUSED_PARAM(mimeType);
> +    UNUSED_PARAM(useCustomContentProvider);

Better to omit or comment out the argument names since that will give an error if we actually do use one, whereas if we use UNUSED_PARAM will keep compiling.
Comment 7 David Kilzer (:ddkilzer) 2020-04-08 13:05:41 PDT
(In reply to Darin Adler from comment #6)
> Comment on attachment 395751 [details]
> Patch v2
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=395751&action=review
> 
> > Source/WebKit/UIProcess/mac/PageClientImplMac.mm:283
> > +    UNUSED_PARAM(mimeType);
> > +    UNUSED_PARAM(useCustomContentProvider);
> 
> Better to omit or comment out the argument names since that will give an
> error if we actually do use one, whereas if we use UNUSED_PARAM will keep
> compiling.

Committed r259750: <https://trac.webkit.org/changeset/259750>