Changeset 225553 in webkit


Ignore:
Timestamp:
Dec 5, 2017 3:15:00 PM (6 years ago)
Author:
achristensen@apple.com
Message:

Fix crash when loading a file URL that does not have a fileSystemPath representation
https://bugs.webkit.org/show_bug.cgi?id=180448
<rdar://problem/22805921>

Reviewed by Chris Dumez.

Source/WebKit:

  • UIProcess/WebProcessProxy.cpp:

(WebKit::WebProcessProxy::assumeReadAccessToBaseURL):
Check if a String is null before adding it to a HashSet.

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm:

(TEST):
Test opening a URL that used to crash WebKit.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r225537 r225553  
     12017-12-05  Alex Christensen  <achristensen@webkit.org>
     2
     3        Fix crash when loading a file URL that does not have a fileSystemPath representation
     4        https://bugs.webkit.org/show_bug.cgi?id=180448
     5        <rdar://problem/22805921>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * UIProcess/WebProcessProxy.cpp:
     10        (WebKit::WebProcessProxy::assumeReadAccessToBaseURL):
     11        Check if a String is null before adding it to a HashSet.
     12
    1132017-12-05  Youenn Fablet  <youenn@apple.com>
    214
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp

    r225289 r225553  
    446446    // Get url's base URL to add to m_localPathsWithAssumedReadAccess.
    447447    URL baseURL(URL(), url.baseAsString());
     448    String path = baseURL.fileSystemPath();
     449    if (path.isNull())
     450        return;
    448451   
    449452    // Client loads an alternate string. This doesn't grant universal file read, but the web process is assumed
    450453    // to have read access to this directory already.
    451     m_localPathsWithAssumedReadAccess.add(baseURL.fileSystemPath());
     454    m_localPathsWithAssumedReadAccess.add(path);
    452455}
    453456
  • trunk/Tools/ChangeLog

    r225552 r225553  
     12017-12-05  Alex Christensen  <achristensen@webkit.org>
     2
     3        Fix crash when loading a file URL that does not have a fileSystemPath representation
     4        https://bugs.webkit.org/show_bug.cgi?id=180448
     5        <rdar://problem/22805921>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm:
     10        (TEST):
     11        Test opening a URL that used to crash WebKit.
     12
    1132017-12-05  Michael Saboff  <msaboff@apple.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm

    r198956 r225553  
    122122}
    123123
     124TEST(WKWebView, LoadAlternateHTMLStringNoFileSystemPath)
     125{
     126    auto webView = adoptNS([[WKWebView alloc] init]);
     127    [webView loadHTMLString:@"<html>hi</html>" baseURL:[NSURL URLWithString:@"file:///.file/id="]];
     128}
     129
    124130#endif
Note: See TracChangeset for help on using the changeset viewer.