Title: [271045] trunk/Source/WebKit
Revision
271045
Author
[email protected]
Date
2020-12-21 16:57:32 -0800 (Mon, 21 Dec 2020)

Log Message

REGRESSION (iOS 14): Bad access crash in ShareableBitmap::makeCGImageCopy() under assignLegacyDataForContextMenuInteraction()
https://bugs.webkit.org/show_bug.cgi?id=219843
<rdar://problem/72537059>

Reviewed by Geoffrey Garen.

Apply a speculative fix for the crash by making the UI process robust in the case where the requested position
information has the `isImage` flag set, but no native image. Additionally, keep the existing debug assertions by
moving them outside of their current if statements.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView assignLegacyDataForContextMenuInteraction]):
(-[WKContentView continueContextMenuInteraction:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (271044 => 271045)


--- trunk/Source/WebKit/ChangeLog	2020-12-22 00:25:43 UTC (rev 271044)
+++ trunk/Source/WebKit/ChangeLog	2020-12-22 00:57:32 UTC (rev 271045)
@@ -1,3 +1,19 @@
+2020-12-21  Wenson Hsieh  <[email protected]>
+
+        REGRESSION (iOS 14): Bad access crash in ShareableBitmap::makeCGImageCopy() under assignLegacyDataForContextMenuInteraction()
+        https://bugs.webkit.org/show_bug.cgi?id=219843
+        <rdar://problem/72537059>
+
+        Reviewed by Geoffrey Garen.
+
+        Apply a speculative fix for the crash by making the UI process robust in the case where the requested position
+        information has the `isImage` flag set, but no native image. Additionally, keep the existing debug assertions by
+        moving them outside of their current if statements.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView assignLegacyDataForContextMenuInteraction]):
+        (-[WKContentView continueContextMenuInteraction:]):
+
 2020-12-21  Chris Dumez  <[email protected]>
 
         Simplify CARingBuffer usage with SharedMemory storage

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (271044 => 271045)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-12-22 00:25:43 UTC (rev 271044)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-12-22 00:57:32 UTC (rev 271045)
@@ -9466,6 +9466,7 @@
 
     auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithInteractionInformationAtPosition:_positionInformation userInfo:nil]);
 
+    ASSERT_IMPLIES(_positionInformation.isImage, _positionInformation.image);
     if (_positionInformation.isLink) {
         _longPressCanClick = NO;
 
@@ -9504,10 +9505,9 @@
 
         _contextMenuLegacyMenu = menuFromLegacyPreviewOrDefaultActions(previewViewController, defaultActionsFromAssistant, elementInfo);
 
-    } else if (_positionInformation.isImage) {
+    } else if (_positionInformation.isImage && _positionInformation.image) {
         NSURL *nsURL = (NSURL *)url;
         RetainPtr<NSDictionary> imageInfo;
-        ASSERT(_positionInformation.image);
         auto cgImage = _positionInformation.image->makeCGImageCopy();
         auto uiImage = adoptNS([[UIImage alloc] initWithCGImage:cgImage.get()]);
 
@@ -9667,7 +9667,6 @@
 #endif
 
     auto completionBlock = makeBlockPtr([continueWithContextMenuConfiguration = makeBlockPtr(continueWithContextMenuConfiguration), linkURL = WTFMove(linkURL), weakSelf = WeakObjCPtr<WKContentView>(self)] (UIContextMenuConfiguration *configurationFromWKUIDelegate) mutable {
-
         auto strongSelf = weakSelf.get();
         if (!strongSelf) {
             continueWithContextMenuConfiguration(nil);
@@ -9681,8 +9680,8 @@
             return;
         }
 
-        if (strongSelf->_positionInformation.isImage && !strongSelf->_positionInformation.isLink) {
-            ASSERT(strongSelf->_positionInformation.image);
+        ASSERT_IMPLIES(strongSelf->_positionInformation.isImage, strongSelf->_positionInformation.image);
+        if (strongSelf->_positionInformation.isImage && strongSelf->_positionInformation.image && !strongSelf->_positionInformation.isLink) {
             auto cgImage = strongSelf->_positionInformation.image->makeCGImageCopy();
 
             strongSelf->_contextMenuActionProviderDelegateNeedsOverride = NO;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to