⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 269778 in webkit


Ignore:
Timestamp:
Nov 13, 2020, 8:04:15 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Crash in ReplaceSelectionCommand::moveNodeOutOfAncestor
https://bugs.webkit.org/show_bug.cgi?id=218878

Patch by Julian Gonzalez <julian_a_gonzalez@apple.com> on 2020-11-13
Reviewed by Alex Christensen.

Source/WebCore:

Add a missing null check inside moveNodeOutOfAncestor, as splitTreeToNode()
can return nullptr.

Test: editing/execCommand/crash-deleting-after-inserting-text-horizontal-rule.html

  • editing/ReplaceSelectionCommand.cpp:

(WebCore::ReplaceSelectionCommand::moveNodeOutOfAncestor):

LayoutTests:

Add simple test that selects elements, and using execCommand() inserts text
and a horizontal rule, and performs a deletion.

  • editing/execCommand/crash-deleting-after-inserting-text-horizontal-rule-expected.txt: Added.
  • editing/execCommand/crash-deleting-after-inserting-text-horizontal-rule.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269776 r269778  
     12020-11-13  Julian Gonzalez  <julian_a_gonzalez@apple.com>
     2
     3        Crash in ReplaceSelectionCommand::moveNodeOutOfAncestor
     4        https://bugs.webkit.org/show_bug.cgi?id=218878
     5
     6        Reviewed by Alex Christensen.
     7
     8        Add simple test that selects elements, and using execCommand() inserts text
     9        and a horizontal rule, and performs a deletion.
     10
     11        * editing/execCommand/crash-deleting-after-inserting-text-horizontal-rule-expected.txt: Added.
     12        * editing/execCommand/crash-deleting-after-inserting-text-horizontal-rule.html: Added.
     13
    1142020-11-13  Rob Buis  <rbuis@igalia.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r269776 r269778  
     12020-11-13  Julian Gonzalez  <julian_a_gonzalez@apple.com>
     2
     3        Crash in ReplaceSelectionCommand::moveNodeOutOfAncestor
     4        https://bugs.webkit.org/show_bug.cgi?id=218878
     5
     6        Reviewed by Alex Christensen.
     7
     8        Add a missing null check inside moveNodeOutOfAncestor, as splitTreeToNode()
     9        can return nullptr.
     10
     11        Test: editing/execCommand/crash-deleting-after-inserting-text-horizontal-rule.html
     12
     13        * editing/ReplaceSelectionCommand.cpp:
     14        (WebCore::ReplaceSelectionCommand::moveNodeOutOfAncestor):
     15
    1162020-11-13  Rob Buis  <rbuis@igalia.com>
    217
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r266557 r269778  
    801801        RefPtr<Node> nodeToSplitTo = splitTreeToNode(node, ancestor, true);
    802802        removeNode(node);
    803         insertNodeBefore(WTFMove(protectedNode), *nodeToSplitTo);
     803        if (nodeToSplitTo)
     804            insertNodeBefore(WTFMove(protectedNode), *nodeToSplitTo);
    804805    }
    805806
Note: See TracChangeset for help on using the changeset viewer.