Changeset 139788 in webkit


Ignore:
Timestamp:
Jan 15, 2013, 2:14:29 PM (12 years ago)
Author:
esprehn@chromium.org
Message:

Heap-use-after-free in WebCore::RenderObject::willBeRemovedFromTree
https://bugs.webkit.org/show_bug.cgi?id=106384

Reviewed by Abhishek Arya.

Source/WebCore:

Always walk up from beforeChild until the parent() is the owner of the
child list, otherwise we can end up in situations where
newChild->parent() == owner but newChild->nextSibling()->parent() != owner
which is a recipe for security bugs. Previously we only walked up through
anonymous blocks, but missed anonymous inline blocks like those generated
by <ruby>.

Test: fast/css-generated-content/bug-106384.html

  • rendering/RenderObjectChildList.cpp:

(WebCore::RenderObjectChildList::insertChildNode):

LayoutTests:

Add a test for <ruby> and generated content causing asserts and
crashes.

  • fast/css-generated-content/bug-106384-expected.txt: Added.
  • fast/css-generated-content/bug-106384.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139785 r139788  
     12013-01-15  Elliott Sprehn  <esprehn@chromium.org>
     2
     3        Heap-use-after-free in WebCore::RenderObject::willBeRemovedFromTree
     4        https://bugs.webkit.org/show_bug.cgi?id=106384
     5
     6        Reviewed by Abhishek Arya.
     7
     8        Add a test for <ruby> and generated content causing asserts and
     9        crashes.
     10
     11        * fast/css-generated-content/bug-106384-expected.txt: Added.
     12        * fast/css-generated-content/bug-106384.html: Added.
     13
    1142013-01-15  Zan Dobersek  <zdobersek@igalia.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r139783 r139788  
     12013-01-15  Elliott Sprehn  <esprehn@chromium.org>
     2
     3        Heap-use-after-free in WebCore::RenderObject::willBeRemovedFromTree
     4        https://bugs.webkit.org/show_bug.cgi?id=106384
     5
     6        Reviewed by Abhishek Arya.
     7
     8        Always walk up from beforeChild until the parent() is the owner of the
     9        child list, otherwise we can end up in situations where
     10        newChild->parent() == owner but newChild->nextSibling()->parent() != owner
     11        which is a recipe for security bugs. Previously we only walked up through
     12        anonymous blocks, but missed anonymous inline blocks like those generated
     13        by <ruby>.
     14
     15        Test: fast/css-generated-content/bug-106384.html
     16
     17        * rendering/RenderObjectChildList.cpp:
     18        (WebCore::RenderObjectChildList::insertChildNode):
     19
    1202013-01-15  Ojan Vafai  <ojan@chromium.org>
    221
  • trunk/Source/WebCore/rendering/RenderObjectChildList.cpp

    r138909 r139788  
    154154
    155155    ASSERT(!child->parent());
    156     while (beforeChild->parent() != owner && beforeChild->parent()->isAnonymousBlock())
     156    while (beforeChild->parent() && beforeChild->parent() != owner)
    157157        beforeChild = beforeChild->parent();
    158     ASSERT(beforeChild->parent() == owner);
     158
     159    // This should never happen, but if it does prevent render tree corruption
     160    // where child->parent() ends up being owner but child->nextSibling()->parent()
     161    // is not owner.
     162    if (beforeChild->parent() != owner) {
     163        ASSERT_NOT_REACHED();
     164        return;
     165    }
    159166
    160167    ASSERT(!owner->isBlockFlow() || (!child->isTableSection() && !child->isTableRow() && !child->isTableCell()));
Note: See TracChangeset for help on using the changeset viewer.