Changeset 89336 in webkit


Ignore:
Timestamp:
Jun 20, 2011 11:05:22 PM (13 years ago)
Author:
aestes@apple.com
Message:

2011-06-20 Andy Estes <aestes@apple.com>

Reviewed by Darin Adler.

KURL::protocolIs(const char* protocol) asserts in Debug builds with
valid protocols
https://bugs.webkit.org/show_bug.cgi?id=61572

No new tests. No code currently calls protocolIs() with a protocol that
contains a non-letter character.

  • platform/KURL.cpp: (WebCore::isSchemeCharacterMatchIgnoringCase): A helper function that compares two characters ignoring case. It assumes (and asserts) that both characters are valid scheme characters, and that if the second argument is a letter that it is lowercase. (WebCore::KURL::protocolIs): Call isSchemeCharacterMatchIgnoringCase() instead of isLetterMatchIgnoringCase().
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r89332 r89336  
     12011-06-20  Andy Estes  <aestes@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        KURL::protocolIs(const char* protocol) asserts in Debug builds with
     6        valid protocols
     7        https://bugs.webkit.org/show_bug.cgi?id=61572
     8
     9        No new tests. No code currently calls protocolIs() with a protocol that
     10        contains a non-letter character.
     11
     12        * platform/KURL.cpp:
     13        (WebCore::isSchemeCharacterMatchIgnoringCase): A helper function that
     14        compares two characters ignoring case. It assumes (and asserts) that
     15        both characters are valid scheme characters, and that if the second
     16        argument is a letter that it is lowercase.
     17        (WebCore::KURL::protocolIs): Call isSchemeCharacterMatchIgnoringCase()
     18        instead of isLetterMatchIgnoringCase().
     19
    1202011-06-20  Dai Mikurube  <dmikurube@chromium.org>
    221
  • trunk/Source/WebCore/platform/KURL.cpp

    r87623 r89336  
    242242static inline bool isPathSegmentEndChar(UChar c) { return c <= 0xff && (characterClassTable[c] & PathSegmentEndChar); }
    243243static inline bool isBadChar(unsigned char c) { return characterClassTable[c] & BadChar; }
     244   
     245static inline bool isSchemeCharacterMatchIgnoringCase(char character, char schemeCharacter)
     246{
     247    ASSERT(isSchemeChar(character));
     248    ASSERT(schemeCharacter & 0x20);
     249    ASSERT(isASCIILower(schemeCharacter) || (!isASCIIUpper(schemeCharacter) && isSchemeChar(schemeCharacter)));
     250    return (character | 0x20) == schemeCharacter;
     251}
    244252
    245253static inline int hexDigitValue(UChar c)
     
    703711    // Do the comparison without making a new string object.
    704712    for (int i = 0; i < m_schemeEnd; ++i) {
    705         if (!protocol[i] || !isLetterMatchIgnoringCase(m_string[i], protocol[i]))
     713        if (!protocol[i] || !isSchemeCharacterMatchIgnoringCase(m_string[i], protocol[i]))
    706714            return false;
    707715    }
Note: See TracChangeset for help on using the changeset viewer.