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

Changeset 110640 in webkit


Ignore:
Timestamp:
Mar 13, 2012, 4:45:53 PM (15 years ago)
Author:
commit-queue@webkit.org
Message:

MathML crash in WebCore::Node::previousSibling()
​https://bugs.webkit.org/show_bug.cgi?id=80773

Patch by Jacky Jiang <​zhajiang@rim.com> on 2012-03-13
Reviewed by Julien Chaffraix.

Source/WebCore:

When adding child for msub render, if the child is mtr or mtd render,
we will creat an anonymous render as the container. As the anonymous
render's node is 0, accessing it directly can cause crash.
We should do a valid check of the node before using. In addition to
that, for msub, attach the anonymous render and it's children to render
tree. For msubsup, such kind of situation should never happen based on
the current codebase.

Test: mathml/msub-anonymous-child-render-crash.html

  • rendering/mathml/RenderMathMLSubSup.cpp:

(WebCore::RenderMathMLSubSup::addChild):

LayoutTests:

  • mathml/msub-anonymous-child-render-crash-expected.txt: Added.
  • mathml/msub-anonymous-child-render-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r110639 r110640  
     12012-03-13  Jacky Jiang  <zhajiang@rim.com>
     2
     3        MathML crash in WebCore::Node::previousSibling()
     4        https://bugs.webkit.org/show_bug.cgi?id=80773
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        * mathml/msub-anonymous-child-render-crash-expected.txt: Added.
     9        * mathml/msub-anonymous-child-render-crash.html: Added.
     10
    1112012-03-13  Mihnea Ovidenie  <mihnea@adobe.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r110639 r110640  
     12012-03-13  Jacky Jiang  <zhajiang@rim.com>
     2
     3        MathML crash in WebCore::Node::previousSibling()
     4        https://bugs.webkit.org/show_bug.cgi?id=80773
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        When adding child for msub render, if the child is mtr or mtd render,
     9        we will creat an anonymous render as the container. As the anonymous
     10        render's node is 0, accessing it directly can cause crash.
     11        We should do a valid check of the node before using. In addition to
     12        that, for msub, attach the anonymous render and it's children to render
     13        tree. For msubsup, such kind of situation should never happen based on
     14        the current codebase.
     15
     16        Test: mathml/msub-anonymous-child-render-crash.html
     17
     18        * rendering/mathml/RenderMathMLSubSup.cpp:
     19        (WebCore::RenderMathMLSubSup::addChild):
     20
    1212012-03-13  Mihnea Ovidenie  <mihnea@adobe.com>
    222
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp

    r109286 r110640  
    6969    Element* childElement = toElement(child->node());
    7070
    71     if (!childElement->previousElementSibling()) {
     71    if (childElement && !childElement->previousElementSibling()) {
    7272        // Position 1 is always the base of the msub/msup/msubsup.
    7373        RenderMathMLBlock* wrapper = new (renderArena()) RenderMathMLBlock(node());
    … …  
    9696    } else {
    9797        if (m_kind == SubSup) {
     98            ASSERT(childElement);
     99            if (!childElement)
     100                return;
     101
    98102            RenderBlock* script = new (renderArena()) RenderMathMLBlock(node());
    99103            RefPtr<RenderStyle> scriptStyle = RenderStyle::create();
Note: See TracChangeset for help on using the changeset viewer.