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

Changeset 273375 in webkit


Ignore:
Timestamp:
Feb 24, 2021, 1:20:30 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Nullptr crash in CompositeEditCommand::splitTreeToNode via InsertParagraphSeparatorCommand::doApply
https://bugs.webkit.org/show_bug.cgi?id=221387

Patch by Frederic Wang <fwang@igalia.com> on 2021-02-24
Reviewed by Ryosuke Niwa.

Source/WebCore:

WebCore::Position::upstream behaves specially for table renderer, which may confuse the
execution of WebCore::InsertParagraphSeparatorCommand::doApply() when the visible position
is within a table, leading to a debug assertion failure and a nullptr dereference in release
build. This patch fixes that by forcing createFragmentFromText to convert <table> to new
a default paragraph element.

Test: fast/editing/paste-and-match-style-with-table-crash.html

  • editing/markup.cpp:

(WebCore::createFragmentFromText): Don't clone enclosing block that are <table>.

LayoutTests:

  • fast/editing/paste-and-match-style-with-table-crash-expected.txt: Added.
  • fast/editing/paste-and-match-style-with-table-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r273374 r273375  
     12021-02-24  Frederic Wang  <fwang@igalia.com>
     2
     3        Nullptr crash in CompositeEditCommand::splitTreeToNode via InsertParagraphSeparatorCommand::doApply
     4        https://bugs.webkit.org/show_bug.cgi?id=221387
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * fast/editing/paste-and-match-style-with-table-crash-expected.txt: Added.
     9        * fast/editing/paste-and-match-style-with-table-crash.html: Added.
     10
    1112021-02-24  Carlos Garcia Campos  <cgarcia@igalia.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r273374 r273375  
     12021-02-24  Frederic Wang  <fwang@igalia.com>
     2
     3        Nullptr crash in CompositeEditCommand::splitTreeToNode via InsertParagraphSeparatorCommand::doApply
     4        https://bugs.webkit.org/show_bug.cgi?id=221387
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        WebCore::Position::upstream behaves specially for table renderer, which may confuse the
     9        execution of WebCore::InsertParagraphSeparatorCommand::doApply() when the visible position
     10        is within a table, leading to a debug assertion failure and a nullptr dereference in release
     11        build. This patch fixes that by forcing createFragmentFromText to convert <table> to new
     12        a default paragraph element.
     13
     14        Test: fast/editing/paste-and-match-style-with-table-crash.html
     15
     16        * editing/markup.cpp:
     17        (WebCore::createFragmentFromText): Don't clone enclosing block that are <table>.
     18
    1192021-02-24  Carlos Garcia Campos  <cgarcia@igalia.com>
    220
  • trunk/Source/WebCore/editing/markup.cpp

    r273058 r273375  
    12001200        && !block->hasTagName(bodyTag)
    12011201        && !block->hasTagName(htmlTag)
     1202        // Avoid using table as paragraphs due to its special treatment in Position::upstream/downstream.
     1203        && !block->hasTagName(tableTag)
    12021204        && block != editableRootForPosition(start);
    12031205    bool useLineBreak = enclosingTextFormControl(start);
Note: See TracChangeset for help on using the changeset viewer.