Changeset 86771 in webkit


Ignore:
Timestamp:
May 18, 2011 9:08:39 AM (13 years ago)
Author:
rwlbuis@webkit.org
Message:

2011-05-18 Rob Buis <rbuis@rim.com>

Reviewed by Nikolas Zimmermann.

NULL deref when SVG elements have table styles
https://bugs.webkit.org/show_bug.cgi?id=45561

Restrict computed CSS values for SVG display property to block, inline or none.

Tests: svg/custom/display-table-caption-foreignObject.svg

svg/custom/display-table-caption-inherit-foreignObject.xhtml
svg/custom/display-table-caption-inherit-text.xhtml
svg/custom/display-table-caption-text.svg

  • css/CSSStyleSelector.cpp: (WebCore::SVGDisplayPropertyGuard::SVGDisplayPropertyGuard): (WebCore::SVGDisplayPropertyGuard::~SVGDisplayPropertyGuard): (WebCore::isAcceptableForSVGElement): (WebCore::CSSStyleSelector::applyProperty):

2011-05-18 Rob Buis <rbuis@rim.com>

Reviewed by Nikolas Zimmermann.

NULL deref when SVG elements have table styles
https://bugs.webkit.org/show_bug.cgi?id=45561

  • svg/custom/display-table-caption-foreignObject-expected.txt: Added.
  • svg/custom/display-table-caption-foreignObject.svg: Added.
  • svg/custom/display-table-caption-inherit-foreignObject-expected.txt: Added.
  • svg/custom/display-table-caption-inherit-foreignObject.xhtml: Added.
  • svg/custom/display-table-caption-inherit-text-expected.txt: Added.
  • svg/custom/display-table-caption-inherit-text.xhtml: Added.
  • svg/custom/display-table-caption-text-expected.txt: Added.
  • svg/custom/display-table-caption-text.svg: Added.
Location:
trunk
Files:
8 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r86770 r86771  
     12011-05-18  Rob Buis  <rbuis@rim.com>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        NULL deref when SVG elements have table styles
     6        https://bugs.webkit.org/show_bug.cgi?id=45561
     7
     8        * svg/custom/display-table-caption-foreignObject-expected.txt: Added.
     9        * svg/custom/display-table-caption-foreignObject.svg: Added.
     10        * svg/custom/display-table-caption-inherit-foreignObject-expected.txt: Added.
     11        * svg/custom/display-table-caption-inherit-foreignObject.xhtml: Added.
     12        * svg/custom/display-table-caption-inherit-text-expected.txt: Added.
     13        * svg/custom/display-table-caption-inherit-text.xhtml: Added.
     14        * svg/custom/display-table-caption-text-expected.txt: Added.
     15        * svg/custom/display-table-caption-text.svg: Added.
     16
    1172011-05-18  Adam Roben  <aroben@apple.com>
    218
  • trunk/Source/WebCore/ChangeLog

    r86768 r86771  
     12011-05-18  Rob Buis  <rbuis@rim.com>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        NULL deref when SVG elements have table styles
     6        https://bugs.webkit.org/show_bug.cgi?id=45561
     7
     8        Restrict computed CSS values for SVG display property to block, inline or none.
     9
     10        Tests: svg/custom/display-table-caption-foreignObject.svg
     11               svg/custom/display-table-caption-inherit-foreignObject.xhtml
     12               svg/custom/display-table-caption-inherit-text.xhtml
     13               svg/custom/display-table-caption-text.svg
     14
     15        * css/CSSStyleSelector.cpp:
     16        (WebCore::SVGDisplayPropertyGuard::SVGDisplayPropertyGuard):
     17        (WebCore::SVGDisplayPropertyGuard::~SVGDisplayPropertyGuard):
     18        (WebCore::isAcceptableForSVGElement):
     19        (WebCore::CSSStyleSelector::applyProperty):
     20
    1212011-05-18  Pavel Feldman  <pfeldman@google.com>
    222
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r86635 r86771  
    88 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
    99 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
     10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
    1011 *
    1112 * This library is free software; you can redistribute it and/or
     
    35413542}
    35423543
     3544class SVGDisplayPropertyGuard {
     3545    WTF_MAKE_NONCOPYABLE(SVGDisplayPropertyGuard);
     3546public:
     3547    SVGDisplayPropertyGuard(Element*, RenderStyle*);
     3548    ~SVGDisplayPropertyGuard();
     3549private:
     3550#if ENABLE(SVG)
     3551    RenderStyle* m_style;
     3552    EDisplay m_originalDisplayPropertyValue;
     3553#endif
     3554};
     3555
     3556#if !ENABLE(SVG)
     3557inline SVGDisplayPropertyGuard::SVGDisplayPropertyGuard(Element*, RenderStyle*)
     3558{
     3559}
     3560
     3561inline SVGDisplayPropertyGuard::~SVGDisplayPropertyGuard()
     3562{
     3563}
     3564#else
     3565static inline bool isAcceptableForSVGElement(EDisplay displayPropertyValue)
     3566{
     3567    return displayPropertyValue == INLINE || displayPropertyValue == BLOCK || displayPropertyValue == NONE;
     3568}
     3569
     3570inline SVGDisplayPropertyGuard::SVGDisplayPropertyGuard(Element* element, RenderStyle* style)
     3571{
     3572    if (!(element && element->isSVGElement() && style->styleType() == NOPSEUDO)) {
     3573        m_originalDisplayPropertyValue = NONE;
     3574        m_style = 0;
     3575        return;
     3576    }
     3577    m_style = style;
     3578    m_originalDisplayPropertyValue = style->display();
     3579    ASSERT(isAcceptableForSVGElement(m_originalDisplayPropertyValue));
     3580}
     3581
     3582inline SVGDisplayPropertyGuard::~SVGDisplayPropertyGuard()
     3583{
     3584    if (!m_style || isAcceptableForSVGElement(m_style->display()))
     3585        return;
     3586    m_style->setDisplay(m_originalDisplayPropertyValue);
     3587}
     3588#endif
     3589
     3590
    35433591// SVG handles zooming in a different way compared to CSS. The whole document is scaled instead
    35443592// of each individual length value in the render style / tree. CSSPrimitiveValue::computeLength*()
     
    36123660        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(clear, Clear)
    36133661        return;
    3614     case CSSPropertyDisplay:
     3662    case CSSPropertyDisplay: {
     3663        SVGDisplayPropertyGuard guard(m_element, m_style.get());
    36153664        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(display, Display)
    36163665#if ENABLE(WCSS)
     
    36303679#endif
    36313680        return;
     3681    }
    36323682    case CSSPropertyEmptyCells:
    36333683        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(emptyCells, EmptyCells)
Note: See TracChangeset for help on using the changeset viewer.