[Webkit-unassigned] [Bug 12830] New: CSS tokenizer calls isalpha/isalnum with non-ASCII characters

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 20 11:34:30 PST 2007


http://bugs.webkit.org/show_bug.cgi?id=12830

           Summary: CSS tokenizer calls isalpha/isalnum with non-ASCII
                    characters
           Product: WebKit
           Version: 420+ (nightly)
          Platform: PC
        OS/Version: Windows XP
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: CSS
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: andy.dyson at yahoo.com


In CSSPrimitiveValue.cpp, IsCSSTokenizerIdentifier calls isalpha and isalnum
for characters beyond the ASCII range. On Windows, a debug build crashes when I
load a page with non-ASCII characters in its CSS [1] because an assertion is
fired by isalpha/isalnum (in MS C library) coming across an non-ASCII
character. 

Thanks to the way a valid character for CSS identifier is defined in CSS spec,
we can neatly avoid this problem just reversing two conditions in two
if-statements in the function.

     // {nmstart}
-    if (p == end || !(p[0] == '_' || isalpha(p[0]) || p[0] >= 128))
+    if (p == end || !(p[0] == '_' || p[0] >= 128u || isalpha(p[0])))
         return false;
     ++p;

     // {nmchar}*
     for (; p != end; ++p) {
-        if (!(p[0] == '_' || p[0] == '-' || isalnum(p[0]) || p[0] >= 128))
+        if (!(p[0] == '_' || p[0] == '-' || p[0] >= 128u || isalnum(p[0])))


I'll upload a patch soon

[1] 
e.g. Pages like http://www.hani.co.kr  have font names in Korean Hangul in
their stylesheets. A lot of CJK pages have font names specified in CJK
characters.


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list