Title: [246706] trunk/Source/WebCore
- Revision
- 246706
- Author
- [email protected]
- Date
- 2019-06-21 21:04:23 -0700 (Fri, 21 Jun 2019)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (246705 => 246706)
--- trunk/Source/WebCore/ChangeLog 2019-06-22 00:28:19 UTC (rev 246705)
+++ trunk/Source/WebCore/ChangeLog 2019-06-22 04:04:23 UTC (rev 246706)
@@ -1,3 +1,18 @@
+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-21 Youenn Fablet <[email protected]>
ResourceLoadNotifier should check whether its frame document loader is null
Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (246705 => 246706)
--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2019-06-22 00:28:19 UTC (rev 246705)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2019-06-22 04:04:23 UTC (rev 246706)
@@ -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