<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>12830</bug_id>
          
          <creation_ts>2007-02-20 11:34:30 -0800</creation_ts>
          <short_desc>CSS tokenizer calls isalpha/isalnum with non-ASCII characters</short_desc>
          <delta_ts>2007-02-27 20:59:21 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>420+</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Andrew Dyson">andy.dyson</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>22495</commentid>
    <comment_count>0</comment_count>
    <who name="Andrew Dyson">andy.dyson</who>
    <bug_when>2007-02-20 11:34:30 -0800</bug_when>
    <thetext>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] == &apos;_&apos; || isalpha(p[0]) || p[0] &gt;= 128))
+    if (p == end || !(p[0] == &apos;_&apos; || p[0] &gt;= 128u || isalpha(p[0])))
         return false;
     ++p;
 
     // {nmchar}*
     for (; p != end; ++p) {
-        if (!(p[0] == &apos;_&apos; || p[0] == &apos;-&apos; || isalnum(p[0]) || p[0] &gt;= 128))
+        if (!(p[0] == &apos;_&apos; || p[0] == &apos;-&apos; || p[0] &gt;= 128u || isalnum(p[0])))


I&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22489</commentid>
    <comment_count>1</comment_count>
    <who name="Andrew Dyson">andy.dyson</who>
    <bug_when>2007-02-20 13:57:17 -0800</bug_when>
    <thetext>I&apos;ve realized that this issue was  resolved on 2007-02-06. Sorry for making noise. 
There was no bug associated with the patch so that I can&apos;t dupe this bug to that and I&apos;m just resolving it as &apos;invalid&apos; (not being able to come up with a better resolution)
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22490</commentid>
    <comment_count>2</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-02-20 14:14:45 -0800</bug_when>
    <thetext>(In reply to comment #1)
&gt; There was no bug associated with the patch so that I can&apos;t dupe this bug to
&gt; that and I&apos;m just resolving it as &apos;invalid&apos; (not being able to come up with a
&gt; better resolution)

It would be helpful to have the Subversion revision number listed here, then I&apos;d reopen/reclose as RESOLVED/FIXED.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20952</commentid>
    <comment_count>3</comment_count>
    <who name="Andrew Dyson">andy.dyson</who>
    <bug_when>2007-02-27 20:58:18 -0800</bug_when>
    <thetext>reopening to resolve/fixed
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20953</commentid>
    <comment_count>4</comment_count>
    <who name="Andrew Dyson">andy.dyson</who>
    <bug_when>2007-02-27 20:59:21 -0800</bug_when>
    <thetext>this was fixed by r19450 | andersca | 2007-02-06 16:28:56 -0800 (Tue, 06 Feb 2007) 

</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>