Changeset 43110 in webkit


Ignore:
Timestamp:
Apr 30, 2009 9:10:25 PM (15 years ago)
Author:
barraclough@apple.com
Message:

JavaScriptCore:

2009-04-30 Gavin Barraclough <barraclough@apple.com>

Reviewed by Geoff Garen.

Bug fix for rdar:/68455379. If a case-insensitive regex contains
a character class containing a range with an upper bound of \uFFFF
the parser will infinite-loop whist adding other-case characters
for characters in the range that do have another case.

  • yarr/RegexCompiler.cpp: (JSC::Yarr::CharacterClassConstructor::putRange):

LayoutTests:

2009-04-30 Gavin Barraclough <barraclough@apple.com>

Reviewed by Geoff Garen.

Add layout test for rdar:/68455379.

  • fast/js/regexp-range-bound-ffff-expected.txt: Added.
  • fast/js/regexp-range-bound-ffff.html: Added.
  • fast/js/resources/regexp-range-bound-ffff.js: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r43105 r43110  
     12009-04-30  Gavin Barraclough  <barraclough@apple.com>
     2
     3        Reviewed by Geoff Garen.
     4
     5        Bug fix for rdar:/68455379.  If a case-insensitive regex contains
     6        a character class containing a range with an upper bound of \uFFFF
     7        the parser will infinite-loop whist adding other-case characters
     8        for characters in the range that do have another case.
     9
     10        * yarr/RegexCompiler.cpp:
     11        (JSC::Yarr::CharacterClassConstructor::putRange):
     12
    1132009-04-30  Gavin Barraclough  <barraclough@apple.com>
    214
  • trunk/JavaScriptCore/yarr/RegexCompiler.cpp

    r43100 r43110  
    109109        }
    110110        if (hi >= 0x80) {
    111             UChar unicodeCurr = std::max(lo, (UChar)0x80);
     111            uint32_t unicodeCurr = std::max(lo, (UChar)0x80);
    112112            addSortedRange(m_rangesUnicode, unicodeCurr, hi);
    113113           
    114114            if (m_isCaseInsensitive) {
    115115                while (unicodeCurr <= hi) {
     116                    // If the upper bound of the range (hi) is 0xffff, the increments to
     117                    // unicodeCurr in this loop may take it to 0x10000.  This is fine
     118                    // (if so we won't re-enter the loop, since the loop condition above
     119                    // will definitely fail) - but this does mean we cannot use a UChar
     120                    // to represent unicodeCurr, we must use a 32-bit value instead.
     121                    ASSERT(unicodeCurr <= 0xffff);
     122
    116123                    if (isUnicodeUpper(unicodeCurr)) {
    117124                        UChar lowerCaseRangeBegin = Unicode::toLower(unicodeCurr);
  • trunk/LayoutTests/ChangeLog

    r43109 r43110  
     12009-04-30  Gavin Barraclough  <barraclough@apple.com>
     2
     3        Reviewed by Geoff Garen.
     4
     5        Add layout test for rdar:/68455379.
     6
     7        * fast/js/regexp-range-bound-ffff-expected.txt: Added.
     8        * fast/js/regexp-range-bound-ffff.html: Added.
     9        * fast/js/resources/regexp-range-bound-ffff.js: Added.
     10
    1112009-04-30  Eric Carlson  <eric.carlson@apple.com>
    212
Note: See TracChangeset for help on using the changeset viewer.