Changeset 166726 in webkit


Ignore:
Timestamp:
Apr 3, 2014 9:48:23 AM (10 years ago)
Author:
Bem Jones-Bey
Message:

[CSS Shapes] CRASH with calc() value args in inset round
https://bugs.webkit.org/show_bug.cgi?id=129816

Reviewed by Andreas Kling.

Source/WebCore:

The code to parse the inset rounded corners was adding the parser
value arguments to a temporary CSSParserValueList. Unfortunately,
CSSParserValueList expects to own the values it contains, and it frees
the values it contains when the list is destroyed. This was a problem
because the values are owned by the CSSParserValueList passed in to
parseInsetRoundedCorners, and thus the calc's argument list would get
double freed, resulting in a crash. This patch fixes this by using a
Vector to hold the pointers instead.

Test: fast/shapes/shape-outside-floats/shape-outside-inset-round-calc-crash.html

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseInsetRoundedCorners):

LayoutTests:

Simple test to make sure that using calc in the round argument of an
inset doesn't cause a crash.

  • fast/shapes/shape-outside-floats/shape-outside-inset-round-calc-crash-expected.txt: Added.
  • fast/shapes/shape-outside-floats/shape-outside-inset-round-calc-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r166717 r166726  
     12014-04-03  Bem Jones-Bey  <bjonesbe@adobe.com>
     2
     3        [CSS Shapes] CRASH with calc() value args in inset round
     4        https://bugs.webkit.org/show_bug.cgi?id=129816
     5
     6        Reviewed by Andreas Kling.
     7
     8        Simple test to make sure that using calc in the round argument of an
     9        inset doesn't cause a crash.
     10
     11        * fast/shapes/shape-outside-floats/shape-outside-inset-round-calc-crash-expected.txt: Added.
     12        * fast/shapes/shape-outside-floats/shape-outside-inset-round-calc-crash.html: Added.
     13
    1142014-04-03  Javier Fernandez  <jfernandez@igalia.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r166722 r166726  
     12014-04-03  Bem Jones-Bey  <bjonesbe@adobe.com>
     2
     3        [CSS Shapes] CRASH with calc() value args in inset round
     4        https://bugs.webkit.org/show_bug.cgi?id=129816
     5
     6        Reviewed by Andreas Kling.
     7
     8        The code to parse the inset rounded corners was adding the parser
     9        value arguments to a temporary CSSParserValueList. Unfortunately,
     10        CSSParserValueList expects to own the values it contains, and it frees
     11        the values it contains when the list is destroyed. This was a problem
     12        because the values are owned by the CSSParserValueList passed in to
     13        parseInsetRoundedCorners, and thus the calc's argument list would get
     14        double freed, resulting in a crash. This patch fixes this by using a
     15        Vector to hold the pointers instead.
     16
     17        Test: fast/shapes/shape-outside-floats/shape-outside-inset-round-calc-crash.html
     18
     19        * css/CSSParser.cpp:
     20        (WebCore::CSSParser::parseInsetRoundedCorners):
     21
    1222014-04-03  Jer Noble  <jer.noble@apple.com>
    223
  • trunk/Source/WebCore/css/CSSParser.cpp

    r166712 r166726  
    53485348        return nullptr;
    53495349
    5350     std::unique_ptr<CSSParserValueList> radiusArguments(new CSSParserValueList);
     5350    Vector<CSSParserValue*> radiusArguments;
    53515351    while (argument) {
    5352         radiusArguments->addValue(*argument);
     5352        radiusArguments.append(argument);
    53535353        argument = args->next();
    53545354    }
    53555355
    5356     unsigned num = radiusArguments->size();
     5356    unsigned num = radiusArguments.size();
    53575357    if (!num || num > 9)
    53585358        return nullptr;
     
    53625362    unsigned indexAfterSlash = 0;
    53635363    for (unsigned i = 0; i < num; ++i) {
    5364         CSSParserValue* value = radiusArguments->valueAt(i);
     5364        CSSParserValue* value = radiusArguments.at(i);
    53655365        if (value->unit == CSSParserValue::Operator) {
    53665366            if (value->iValue != '/')
Note: See TracChangeset for help on using the changeset viewer.