Title: [246762] branches/safari-608.1.31.0-branch/Source/WebCore
Revision
246762
Author
[email protected]
Date
2019-06-24 13:16:44 -0700 (Mon, 24 Jun 2019)

Log Message

Cherry-pick r246706. rdar://problem/51161612

    Nullptr crash in DeleteSelectionCommand::handleGeneralDelete
    https://bugs.webkit.org/show_bug.cgi?id=199126

    Reviewed by Wenson Hsieh.

    Added null checks to handleGeneralDelete as well as mergeParagraphs which runs after handleGeneralDelete to be defensive.

    Unfortunately no new tests since there is no reproducible test case.

    * editing/DeleteSelectionCommand.cpp:
    (WebCore::DeleteSelectionCommand::handleGeneralDelete):
    (WebCore::DeleteSelectionCommand::mergeParagraphs):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246706 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608.1.31.0-branch/Source/WebCore/ChangeLog (246761 => 246762)


--- branches/safari-608.1.31.0-branch/Source/WebCore/ChangeLog	2019-06-24 20:09:12 UTC (rev 246761)
+++ branches/safari-608.1.31.0-branch/Source/WebCore/ChangeLog	2019-06-24 20:16:44 UTC (rev 246762)
@@ -1,3 +1,38 @@
+2019-06-24  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r246706. rdar://problem/51161612
+
+    Nullptr crash in DeleteSelectionCommand::handleGeneralDelete
+    https://bugs.webkit.org/show_bug.cgi?id=199126
+    
+    Reviewed by Wenson Hsieh.
+    
+    Added null checks to handleGeneralDelete as well as mergeParagraphs which runs after handleGeneralDelete to be defensive.
+    
+    Unfortunately no new tests since there is no reproducible test case.
+    
+    * editing/DeleteSelectionCommand.cpp:
+    (WebCore::DeleteSelectionCommand::handleGeneralDelete):
+    (WebCore::DeleteSelectionCommand::mergeParagraphs):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-06-21  Ryosuke Niwa  <[email protected]>
+
+            Nullptr crash in DeleteSelectionCommand::handleGeneralDelete
+            https://bugs.webkit.org/show_bug.cgi?id=199126
+
+            Reviewed by Wenson Hsieh.
+
+            Added null checks to handleGeneralDelete as well as mergeParagraphs which runs after handleGeneralDelete to be defensive.
+
+            Unfortunately no new tests since there is no reproducible test case.
+
+            * editing/DeleteSelectionCommand.cpp:
+            (WebCore::DeleteSelectionCommand::handleGeneralDelete):
+            (WebCore::DeleteSelectionCommand::mergeParagraphs):
+
 2019-06-20  Simon Fraser  <[email protected]>
 
         Make it possible to include clipping in GraphicsLayer tree dumps

Modified: branches/safari-608.1.31.0-branch/Source/WebCore/editing/DeleteSelectionCommand.cpp (246761 => 246762)


--- branches/safari-608.1.31.0-branch/Source/WebCore/editing/DeleteSelectionCommand.cpp	2019-06-24 20:09:12 UTC (rev 246761)
+++ branches/safari-608.1.31.0-branch/Source/WebCore/editing/DeleteSelectionCommand.cpp	2019-06-24 20:16:44 UTC (rev 246762)
@@ -610,7 +610,9 @@
             }
         }
         
-        if (m_downstreamEnd.deprecatedNode() != startNode && !m_upstreamStart.deprecatedNode()->isDescendantOf(m_downstreamEnd.deprecatedNode()) && m_downstreamEnd.anchorNode()->isConnected() && m_downstreamEnd.deprecatedEditingOffset() >= caretMinOffset(*m_downstreamEnd.deprecatedNode())) {
+        if (!m_downstreamEnd.isNull() && !m_downstreamEnd.isOrphan() && m_downstreamEnd.deprecatedNode() != startNode
+            && !m_upstreamStart.deprecatedNode()->isDescendantOf(m_downstreamEnd.deprecatedNode())
+            && m_downstreamEnd.deprecatedEditingOffset() >= caretMinOffset(*m_downstreamEnd.deprecatedNode())) {
             if (m_downstreamEnd.atLastEditingPositionForNode() && !canHaveChildrenForEditing(*m_downstreamEnd.deprecatedNode())) {
                 // The node itself is fully selected, not just its contents.  Delete it.
                 removeNode(*m_downstreamEnd.deprecatedNode());
@@ -679,7 +681,7 @@
     ASSERT(!m_pruneStartBlockIfNecessary);
 
     // FIXME: Deletion should adjust selection endpoints as it removes nodes so that we never get into this state (4099839).
-    if (!m_downstreamEnd.anchorNode()->isConnected() || !m_upstreamStart.anchorNode()->isConnected())
+    if (m_downstreamEnd.isNull() || m_upstreamStart.isNull() || !m_downstreamEnd.anchorNode()->isConnected() || !m_upstreamStart.anchorNode()->isConnected())
          return;
 
     // FIXME: The deletion algorithm shouldn't let this happen.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to