Bug 12830
Summary: | CSS tokenizer calls isalpha/isalnum with non-ASCII characters | ||
---|---|---|---|
Product: | WebKit | Reporter: | Andrew Dyson <andy.dyson> |
Component: | CSS | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | ||
Priority: | P2 | ||
Version: | 420+ | ||
Hardware: | PC | ||
OS: | Windows XP |
Andrew Dyson
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.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Andrew Dyson
I'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't dupe this bug to that and I'm just resolving it as 'invalid' (not being able to come up with a better resolution)
David Kilzer (:ddkilzer)
(In reply to comment #1)
> There was no bug associated with the patch so that I can't dupe this bug to
> that and I'm just resolving it as 'invalid' (not being able to come up with a
> better resolution)
It would be helpful to have the Subversion revision number listed here, then I'd reopen/reclose as RESOLVED/FIXED.
Andrew Dyson
reopening to resolve/fixed
Andrew Dyson
this was fixed by r19450 | andersca | 2007-02-06 16:28:56 -0800 (Tue, 06 Feb 2007)