Title: [234369] trunk/Source/WebKit
Revision
234369
Author
[email protected]
Date
2018-07-30 09:50:40 -0700 (Mon, 30 Jul 2018)

Log Message

Potential null dereference under WebPage::applicationDidBecomeActive()
https://bugs.webkit.org/show_bug.cgi?id=188170
<rdar://problem/37493418>

Reviewed by Wenson Hsieh.

WebPage::m_page gets nulled out when the page is closed but the WebPage object may receive IPC
until it gets destroyed. Therefore, we need to null-check m_page before using it in IPC message
handlers.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::applicationDidEnterBackground):
(WebKit::WebPage::applicationWillEnterForeground):
(WebKit::WebPage::applicationDidBecomeActive):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (234368 => 234369)


--- trunk/Source/WebKit/ChangeLog	2018-07-30 16:36:42 UTC (rev 234368)
+++ trunk/Source/WebKit/ChangeLog	2018-07-30 16:50:40 UTC (rev 234369)
@@ -1,3 +1,20 @@
+2018-07-30  Chris Dumez  <[email protected]>
+
+        Potential null dereference under WebPage::applicationDidBecomeActive()
+        https://bugs.webkit.org/show_bug.cgi?id=188170
+        <rdar://problem/37493418>
+
+        Reviewed by Wenson Hsieh.
+
+        WebPage::m_page gets nulled out when the page is closed but the WebPage object may receive IPC
+        until it gets destroyed. Therefore, we need to null-check m_page before using it in IPC message
+        handlers.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::applicationDidEnterBackground):
+        (WebKit::WebPage::applicationWillEnterForeground):
+        (WebKit::WebPage::applicationDidBecomeActive):
+
 2018-07-29  Wenson Hsieh  <[email protected]>
 
         Fix incorrect guards around a method declaration in PageClient.h

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (234368 => 234369)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2018-07-30 16:36:42 UTC (rev 234368)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2018-07-30 16:50:40 UTC (rev 234369)
@@ -2796,7 +2796,8 @@
     m_isSuspendedUnderLock = isSuspendedUnderLock;
     setLayerTreeStateIsFrozen(true);
 
-    m_page->applicationDidEnterBackground();
+    if (m_page)
+        m_page->applicationDidEnterBackground();
 }
 
 void WebPage::applicationDidFinishSnapshottingAfterEnteringBackground()
@@ -2812,13 +2813,15 @@
 
     [[NSNotificationCenter defaultCenter] postNotificationName:WebUIApplicationWillEnterForegroundNotification object:nil userInfo:@{@"isSuspendedUnderLock": @(isSuspendedUnderLock)}];
 
-    m_page->applicationWillEnterForeground();
+    if (m_page)
+        m_page->applicationWillEnterForeground();
 }
 
 void WebPage::applicationDidBecomeActive()
 {
     [[NSNotificationCenter defaultCenter] postNotificationName:WebUIApplicationDidBecomeActiveNotification object:nil];
-    m_page->applicationDidBecomeActive();
+    if (m_page)
+        m_page->applicationDidBecomeActive();
 }
 
 static inline void adjustVelocityDataForBoundedScale(double& horizontalVelocity, double& verticalVelocity, double& scaleChangeRate, double exposedRectScale, double minimumScale, double maximumScale)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to