Title: [273482] trunk/Source/WebCore
Revision
273482
Author
[email protected]
Date
2021-02-25 07:05:08 -0800 (Thu, 25 Feb 2021)

Log Message

[iOS] Crash in ValidationBubble::show()
https://bugs.webkit.org/show_bug.cgi?id=221565
<rdar://problem/74360282>

Reviewed by Megan Gardner.

Fixes the crash by turning the raw ObjC id `m_presentingViewController` on `ValidationBubble` into a
`WeakObjCPtr` instead, such that failure to initialize the member underneath `ValidationBubble::setAnchorRect`
won't cause undefined behavior.

In theory, this scenario is already exercised by the existing API test
`FormValidation.PresentingFormValidationUIWithoutViewControllerDoesNotCrash`, though it may not be crashing
with enough frequency to have resulted in a documented test failure, due to the uninitialized `id` frequently
turning out to be `nil` anyways.

* platform/ValidationBubble.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273481 => 273482)


--- trunk/Source/WebCore/ChangeLog	2021-02-25 14:39:04 UTC (rev 273481)
+++ trunk/Source/WebCore/ChangeLog	2021-02-25 15:05:08 UTC (rev 273482)
@@ -1,3 +1,22 @@
+2021-02-25  Wenson Hsieh  <[email protected]>
+
+        [iOS] Crash in ValidationBubble::show()
+        https://bugs.webkit.org/show_bug.cgi?id=221565
+        <rdar://problem/74360282>
+
+        Reviewed by Megan Gardner.
+
+        Fixes the crash by turning the raw ObjC id `m_presentingViewController` on `ValidationBubble` into a
+        `WeakObjCPtr` instead, such that failure to initialize the member underneath `ValidationBubble::setAnchorRect`
+        won't cause undefined behavior.
+
+        In theory, this scenario is already exercised by the existing API test
+        `FormValidation.PresentingFormValidationUIWithoutViewControllerDoesNotCrash`, though it may not be crashing
+        with enough frequency to have resulted in a documented test failure, due to the uninitialized `id` frequently
+        turning out to be `nil` anyways.
+
+        * platform/ValidationBubble.h:
+
 2021-02-25  Philippe Normand  <[email protected]>
 
         Unreviewed, WPE/GTK build warning fix after r273311

Modified: trunk/Source/WebCore/platform/ValidationBubble.h (273481 => 273482)


--- trunk/Source/WebCore/platform/ValidationBubble.h	2021-02-25 14:39:04 UTC (rev 273481)
+++ trunk/Source/WebCore/platform/ValidationBubble.h	2021-02-25 15:05:08 UTC (rev 273482)
@@ -31,6 +31,7 @@
 
 #if PLATFORM(COCOA)
 #include <wtf/RetainPtr.h>
+#include <wtf/WeakObjCPtr.h>
 #endif
 
 #if PLATFORM(MAC)
@@ -89,7 +90,7 @@
     RetainPtr<WebValidationBubbleViewController> m_popoverController;
     RetainPtr<WebValidationBubbleTapRecognizer> m_tapRecognizer;
     RetainPtr<WebValidationBubbleDelegate> m_popoverDelegate;
-    UIViewController *m_presentingViewController;
+    WeakObjCPtr<UIViewController> m_presentingViewController;
 #endif
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to