Title: [225553] trunk
Revision
225553
Author
[email protected]
Date
2017-12-05 15:15:00 -0800 (Tue, 05 Dec 2017)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (225552 => 225553)


--- trunk/Source/WebKit/ChangeLog	2017-12-05 23:01:07 UTC (rev 225552)
+++ trunk/Source/WebKit/ChangeLog	2017-12-05 23:15:00 UTC (rev 225553)
@@ -1,3 +1,15 @@
+2017-12-05  Alex Christensen  <[email protected]>
+
+        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.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::assumeReadAccessToBaseURL):
+        Check if a String is null before adding it to a HashSet.
+
 2017-12-05  Youenn Fablet  <[email protected]>
 
         Implement https://w3c.github.io/ServiceWorker/#clients-claim

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (225552 => 225553)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2017-12-05 23:01:07 UTC (rev 225552)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2017-12-05 23:15:00 UTC (rev 225553)
@@ -445,10 +445,13 @@
     // There's a chance that urlString does not point to a directory.
     // Get url's base URL to add to m_localPathsWithAssumedReadAccess.
     URL baseURL(URL(), url.baseAsString());
+    String path = baseURL.fileSystemPath();
+    if (path.isNull())
+        return;
     
     // Client loads an alternate string. This doesn't grant universal file read, but the web process is assumed
     // to have read access to this directory already.
-    m_localPathsWithAssumedReadAccess.add(baseURL.fileSystemPath());
+    m_localPathsWithAssumedReadAccess.add(path);
 }
 
 bool WebProcessProxy::hasAssumedReadAccessToURL(const URL& url) const

Modified: trunk/Tools/ChangeLog (225552 => 225553)


--- trunk/Tools/ChangeLog	2017-12-05 23:01:07 UTC (rev 225552)
+++ trunk/Tools/ChangeLog	2017-12-05 23:15:00 UTC (rev 225553)
@@ -1,3 +1,15 @@
+2017-12-05  Alex Christensen  <[email protected]>
+
+        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.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm:
+        (TEST):
+        Test opening a URL that used to crash WebKit.
+
 2017-12-05  Michael Saboff  <[email protected]>
 
         Make WebKit build for ARM64_32

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm (225552 => 225553)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm	2017-12-05 23:01:07 UTC (rev 225552)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm	2017-12-05 23:15:00 UTC (rev 225553)
@@ -121,4 +121,10 @@
     }
 }
 
+TEST(WKWebView, LoadAlternateHTMLStringNoFileSystemPath)
+{
+    auto webView = adoptNS([[WKWebView alloc] init]);
+    [webView loadHTMLString:@"<html>hi</html>" baseURL:[NSURL URLWithString:@"file:///.file/id="]];
+}
+
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to