Title: [266287] trunk/Source/WebKit
Revision
266287
Author
[email protected]
Date
2020-08-28 11:33:52 -0700 (Fri, 28 Aug 2020)

Log Message

REGRESSION(r266187): ARGUMENT BAD: WebIconUtilities.mm(138) : RetainPtr<UIImage> WebKit::iconForFile(NSURL *) file, [file isFileURL]
https://bugs.webkit.org/show_bug.cgi?id=215931

Patch by Alex Christensen <[email protected]> on 2020-08-28
Reviewed by Wenson Hsieh.

It's possible for _javascript_ to make a filename that doesn't convert to a file URL, such as the empty string.
When this happens, we would've returned null for the icon later anyways, but adding a null check prevents an assertion.
Covered by 7 existing tests which would have hit that assertion.

* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::createIconForFiles):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (266286 => 266287)


--- trunk/Source/WebKit/ChangeLog	2020-08-28 18:02:36 UTC (rev 266286)
+++ trunk/Source/WebKit/ChangeLog	2020-08-28 18:33:52 UTC (rev 266287)
@@ -1,3 +1,17 @@
+2020-08-28  Alex Christensen  <[email protected]>
+
+        REGRESSION(r266187): ARGUMENT BAD: WebIconUtilities.mm(138) : RetainPtr<UIImage> WebKit::iconForFile(NSURL *) file, [file isFileURL]
+        https://bugs.webkit.org/show_bug.cgi?id=215931
+
+        Reviewed by Wenson Hsieh.
+
+        It's possible for _javascript_ to make a filename that doesn't convert to a file URL, such as the empty string.
+        When this happens, we would've returned null for the icon later anyways, but adding a null check prevents an assertion.
+        Covered by 7 existing tests which would have hit that assertion.
+
+        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
+        (WebKit::WebChromeClient::createIconForFiles):
+
 2020-08-28  Youenn Fablet  <[email protected]>
 
         Enable TransformStream by default

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm (266286 => 266287)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm	2020-08-28 18:02:36 UTC (rev 266286)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm	2020-08-28 18:33:52 UTC (rev 266287)
@@ -154,7 +154,11 @@
 
     // FIXME: We should generate an icon showing multiple files here, if applicable. Currently, if there are multiple
     // files, we only use the first URL to generate an icon.
-    return Icon::createIconForImage(iconForFile([NSURL fileURLWithPath:filenames[0] isDirectory:NO]).get().CGImage);
+    NSURL *url = "" fileURLWithPath:filenames[0] isDirectory:NO];
+    if (!url)
+        return nullptr;
+
+    return Icon::createIconForImage(iconForFile(url).get().CGImage);
 }
 
 void WebChromeClient::associateEditableImageWithAttachment(GraphicsLayer::EmbeddedViewID embeddedViewID, const String& attachmentID)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to