Title: [270810] trunk/Source/WebKit
- Revision
- 270810
- Author
- [email protected]
- Date
- 2020-12-14 17:00:22 -0800 (Mon, 14 Dec 2020)
Log Message
Fix null dereference in WKURLCopyCFURL
https://bugs.webkit.org/show_bug.cgi?id=219877
<rdar://problem/48921304>
Patch by Alex Christensen <[email protected]> on 2020-12-14
Reviewed by Geoffrey Garen.
We had an optimistic assertion and crash reports indicating that it is not always true.
When it's not, return null instead of crashing.
* Shared/API/c/cf/WKURLCF.mm:
(WKURLCopyCFURL):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (270809 => 270810)
--- trunk/Source/WebKit/ChangeLog 2020-12-15 00:19:29 UTC (rev 270809)
+++ trunk/Source/WebKit/ChangeLog 2020-12-15 01:00:22 UTC (rev 270810)
@@ -1,3 +1,17 @@
+2020-12-14 Alex Christensen <[email protected]>
+
+ Fix null dereference in WKURLCopyCFURL
+ https://bugs.webkit.org/show_bug.cgi?id=219877
+ <rdar://problem/48921304>
+
+ Reviewed by Geoffrey Garen.
+
+ We had an optimistic assertion and crash reports indicating that it is not always true.
+ When it's not, return null instead of crashing.
+
+ * Shared/API/c/cf/WKURLCF.mm:
+ (WKURLCopyCFURL):
+
2020-12-14 Chris Dumez <[email protected]>
Unreviewed, reverting r270768.
Modified: trunk/Source/WebKit/Shared/API/c/cf/WKURLCF.mm (270809 => 270810)
--- trunk/Source/WebKit/Shared/API/c/cf/WKURLCF.mm 2020-12-15 00:19:29 UTC (rev 270809)
+++ trunk/Source/WebKit/Shared/API/c/cf/WKURLCF.mm 2020-12-15 01:00:22 UTC (rev 270810)
@@ -59,11 +59,13 @@
CFURLRef WKURLCopyCFURL(CFAllocatorRef allocatorRef, WKURLRef URLRef)
{
- ASSERT(!WebKit::toImpl(URLRef)->string().isNull());
+ auto& string = WebKit::toImpl(URLRef)->string();
+ if (string.isNull())
+ return nullptr;
// We first create a CString and then create the CFURL from it. This will ensure that the CFURL is stored in
// UTF-8 which uses less memory and is what WebKit clients might expect.
- CString buffer = WebKit::toImpl(URLRef)->string().utf8();
+ CString buffer = string.utf8();
return CFURLCreateAbsoluteURLWithBytes(nullptr, reinterpret_cast<const UInt8*>(buffer.data()), buffer.length(), kCFStringEncodingUTF8, nullptr, true);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes