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 10120 - Checker may crash when CSS @charset declaration is invalid
Summary: Checker may crash when CSS @charset declaration is invalid
Status: RESOLVED FIXED
Alias: None
Product: mobileOK Basic checker
Classification: Unclassified
Component: Java Library (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: fd
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-09 10:33 UTC by fd
Modified: 2010-07-09 16:29 UTC (History)
0 users

See Also:


Attachments

Description fd 2010-07-09 10:33:41 UTC
The following invalid @charset declaration makes the library crash:
 @charset="utf-8";
(it is invalid because of the "=" sign which should not be there)

The exception is as follows:

Exception in thread "main" org.w3c.mwi.mobileok.basic.TestException: One or more exceptions were caught while processing the resources:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
java.lang.String.substring(String.java:1949)
org.w3c.mwi.mobileok.basic.CSSUtils.extractCSSWarnings(CSSUtils.java:277)
org.w3c.mwi.mobileok.basic.CssContent.<init>(CssContent.java:119)
org.w3c.mwi.mobileok.basic.MobileOKDecodedContentFactory.decodeContent(MobileOKDecodedContentFactory.java:93)
org.w3c.mwi.mobileok.basic.Resource.decode(Resource.java:239)
org.w3c.mwi.mobileok.basic.Preprocessor.processResource(Preprocessor.java:475)
org.w3c.mwi.mobileok.basic.Preprocessor.access$0(Preprocessor.java:450)
org.w3c.mwi.mobileok.basic.Preprocessor$2.run(Preprocessor.java:513)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:636)

at org.w3c.mwi.mobileok.basic.Preprocessor.preprocess(Preprocessor.java:420)
at org.w3c.mwi.mobileok.basic.Tester.getPreprocessorResults(Tester.java:140)
at org.w3c.mwi.mobileok.basic.Tester.main(Tester.java:397)
Comment 1 fd 2010-07-09 16:29:14 UTC
The code was taking for granted that the line that contains the invalid at-rule would contain a space, leading to the out of range exception.

Code sanitized.

Created a bug on the CSS validator because the messages returned by the CSS validator are a bit misleading in that case:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=10124 (bug 10124)