This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 3627 - Validator incorrectly reports failure when using CSS2 grammar - parses full-length numeric escapes incorrectly
Summary: Validator incorrectly reports failure when using CSS2 grammar - parses full-l...
Status: RESOLVED FIXED
Alias: None
Product: CSSValidator
Classification: Unclassified
Component: CSS 2.0 (show other bugs)
Version: CSS Validator
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Olivier Thereaux
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-26 00:18 UTC by CecilWard
Modified: 2007-07-17 07:24 UTC (History)
1 user (show)

See Also:


Attachments
A patch (1.37 KB, patch)
2007-04-10 14:12 UTC, Peter Zhelezniakov
Details
CSS1 allows escape sequences 4 chars long maximum (1.48 KB, patch)
2007-04-12 13:35 UTC, Peter Zhelezniakov
Details

Description CecilWard 2006-08-26 00:18:58 UTC
I believe that the following CSS2 fragment is legal CSS, if my reading of CSS 2 is correct, yet the validator incorrectly reports an error with grammar=CSS2 selected. Test case:

	selector { color: gr\000065en; }

Reasoning: in CSS2 no terminating space is required after a full-length numeric escape sequence, filled out to the maximum of six characters. So in CSS2 the property value is "red". See the productions for "escape" in the CSS2 grammar.


[FYI, compare 
	selector { color: gre\000065n; }
	selector { color: r\000065 d; }
both of which is correctly reported as valid. It seems to be that the parser is reading characters after the sixth hex digit and parsing them as part of the number.]

Regards,

Cecil Ward.
Comment 1 Peter Zhelezniakov 2007-04-10 14:12:29 UTC
Created attachment 462 [details]
A patch

The idea of the patch is to terminate parsing of an escape sequence when either a non-digit is encountered, or six chars has been processed. In both cases whitespace following the escape sequence, if any, is skipped.
Comment 2 Peter Zhelezniakov 2007-04-10 14:14:00 UTC
Comment on attachment 462 [details]
A patch

The code in CssParser.convertStringIndex() fails to enforce the "no more than 6 chars" rule for escape sequences. In fact, it has a (count < 6) check, but fails to increment the counter.
Comment 3 Peter Zhelezniakov 2007-04-12 13:35:52 UTC
Created attachment 463 [details]
CSS1 allows escape sequences 4 chars long maximum

CSS1 allows escape sequences to be 4 chars long maximum, while CSS2+ allows 6 chars. We need to conditionalize on CSS version.
Comment 4 Olivier Thereaux 2007-04-24 10:27:59 UTC
Peter,

Your patch looks good to me. I commited it to CVS, so now we can test and move to prod if all looks good.

Yves, will you have a chance to double-check the patch?


Comment 5 Olivier Thereaux 2007-07-17 07:24:10 UTC
CVS version now in production. Closing.