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

Changeset 274849 in webkit


Ignore:
Timestamp:
Mar 22, 2021, 11:23:57 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Nullptr crash in WebCore::RenderObject::RenderObjectBitfields::isLineBreak() where a NULL check is missing.
https://bugs.webkit.org/show_bug.cgi?id=223409

Patch by Venky Dass <yaranamavenkataramana@apple.com> on 2021-03-22
Reviewed by Ryosuke Niwa.

Source/WebCore:

When the check for LineBreak is performed the BR elmement NULL check is not performed. Which results in a crash
The fix therefore is to check for NULL.

Test: LayoutTests/editing/inserting/insert-paragraph-between-hr-and-br-assigned-to-slot-crash.html

  • editing/InsertParagraphSeparatorCommand.cpp:

(WebCore::InsertParagraphSeparatorCommand::doApply):

LayoutTests:

Adding a regression test case.

  • editing/inserting/insert-paragraph-between-hr-and-br-assigned-to-slot-crash-expected.txt: Added.
  • editing/inserting/insert-paragraph-between-hr-and-br-assigned-to-slot-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r274847 r274849  
     12021-03-22  Venky Dass  <yaranamavenkataramana@apple.com>
     2
     3        Nullptr crash in  WebCore::RenderObject::RenderObjectBitfields::isLineBreak() where a NULL check is missing.
     4        https://bugs.webkit.org/show_bug.cgi?id=223409
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Adding a regression test case.
     9       
     10        * editing/inserting/insert-paragraph-between-hr-and-br-assigned-to-slot-crash-expected.txt: Added.
     11        * editing/inserting/insert-paragraph-between-hr-and-br-assigned-to-slot-crash.html: Added.
     12
    1132021-03-22  Julian Gonzalez  <julian_a_gonzalez@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r274847 r274849  
     12021-03-22  Venky Dass  <yaranamavenkataramana@apple.com>
     2
     3        Nullptr crash in  WebCore::RenderObject::RenderObjectBitfields::isLineBreak() where a NULL check is missing.
     4        https://bugs.webkit.org/show_bug.cgi?id=223409
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        When the check for LineBreak is performed the BR elmement NULL check is not performed. Which results in a crash
     9        The fix therefore is to check for NULL.
     10       
     11        Test: LayoutTests/editing/inserting/insert-paragraph-between-hr-and-br-assigned-to-slot-crash.html
     12
     13        * editing/InsertParagraphSeparatorCommand.cpp:
     14        (WebCore::InsertParagraphSeparatorCommand::doApply):
     15
    1162021-03-22  Julian Gonzalez  <julian_a_gonzalez@apple.com>
    217
  • trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp

    r273330 r274849  
    314314        // If the insertion point is a break element, there is nothing else
    315315        // we need to do.
    316         if (visiblePos.deepEquivalent().anchorNode()->renderer()->isBR()) {
     316        if (auto* renderer = visiblePos.deepEquivalent().anchorNode()->renderer(); renderer && renderer->isBR()) {
    317317            setEndingSelection(VisibleSelection(insertionPosition, Affinity::Downstream, endingSelection().isDirectional()));
    318318            return;
Note: See TracChangeset for help on using the changeset viewer.