Changeset 172036 in webkit


Ignore:
Timestamp:
Aug 5, 2014 11:14:31 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

ASSERTION FAILED: name[0] == '@' && length >= 2 in WebCore::CSSParser::detectAtToken
https://bugs.webkit.org/show_bug.cgi?id=134632

Source/WebCore:

At-rules must consist of at least two characters: the '@' symbol followed by
an identifier name. The failure of this condition makes the assertion fail.

The length of an at-rule is currently calculated by pointer arithmetic on
the 'result' pointer, which is expected to be set to the end of the at-rule
identifier by the WebCore::*CSSTokenizer::parseIdentifier method.
If the at-rule token is a sequence of 8-bit-only characters then
'result' will point correctly at the end of the identifier. However, if
the at-rule contains a 16-bit Unicode escape then 'result' will not be
updated correctly anymore, hence it cannot be used for length calculation.
The patch makes the parseIdentifier bump the result pointer even in the 16-bit slow case.

Patch by Renata Hodovan, backported from Chromium: https://codereview.chromium.org/241053002

Patch by Martin Hodovan <mhodovan.u-szeged@partner.samsung.com> on 2014-08-05
Reviewed by Darin Adler.

Test: fast/css/atrule-with-escape-character-crash.html

  • css/CSSParser.cpp:

(WebCore::CSSParser::realLex):

LayoutTests:

Added test demonstrates that at-rules containing 16-bit Unicode characters
can be handled properly.

Patch by Martin Hodovan <mhodovan.u-szeged@partner.samsung.com> on 2014-08-05
Reviewed by Darin Adler.

  • fast/css/atrule-with-escape-character-crash-expected.txt: Added.
  • fast/css/atrule-with-escape-character-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r172033 r172036  
     12014-08-05  Martin Hodovan  <mhodovan.u-szeged@partner.samsung.com>
     2
     3        ASSERTION FAILED: name[0] == '@' && length >= 2 in WebCore::CSSParser::detectAtToken
     4        https://bugs.webkit.org/show_bug.cgi?id=134632
     5
     6        Added test demonstrates that at-rules containing 16-bit Unicode characters
     7        can be handled properly.
     8
     9        Reviewed by Darin Adler.
     10
     11        * fast/css/atrule-with-escape-character-crash-expected.txt: Added.
     12        * fast/css/atrule-with-escape-character-crash.html: Added.
     13
    1142014-08-05  Renata Hodovan  <rhodovan.u-szeged@partner.samsung.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r172035 r172036  
     12014-08-05  Martin Hodovan  <mhodovan.u-szeged@partner.samsung.com>
     2
     3        ASSERTION FAILED: name[0] == '@' && length >= 2 in WebCore::CSSParser::detectAtToken
     4        https://bugs.webkit.org/show_bug.cgi?id=134632
     5
     6        At-rules must consist of at least two characters: the '@' symbol followed by
     7        an identifier name. The failure of this condition makes the assertion fail.
     8
     9        The length of an at-rule is currently calculated by pointer arithmetic on
     10        the 'result' pointer, which is expected to be set to the end of the at-rule
     11        identifier by the WebCore::*CSSTokenizer::parseIdentifier method.
     12        If the at-rule token is a sequence of 8-bit-only characters then
     13        'result' will point correctly at the end of the identifier. However, if
     14        the at-rule contains a 16-bit Unicode escape then 'result' will not be
     15        updated correctly anymore, hence it cannot be used for length calculation.
     16        The patch makes the parseIdentifier bump the result pointer even in the 16-bit slow case.
     17
     18        Patch by Renata Hodovan, backported from Chromium: https://codereview.chromium.org/241053002
     19
     20        Reviewed by Darin Adler.
     21
     22        Test: fast/css/atrule-with-escape-character-crash.html
     23
     24        * css/CSSParser.cpp:
     25        (WebCore::CSSParser::realLex):
     26
    1272014-08-04  Andy Estes  <aestes@apple.com>
    228
  • trunk/Source/WebCore/css/CSSParser.cpp

    r172033 r172036  
    1029910299        parseIdentifierInternal(currentCharacter<CharacterType>(), result16, hasEscape);
    1030010300
     10301        result += result16 - start16;
    1030110302        resultString.init(start16, result16 - start16);
    1030210303
Note: See TracChangeset for help on using the changeset viewer.