Bugzilla – Bug 823
Array index out of bounds in meta scanner
Last modified: 2011-05-16 19:14:49 CEST
The following code: <meta property=og:site_name content=eFlorist Mobile - TT /> is generating the following stacktrace: java.lang.ArrayIndexOutOfBoundsException: -1 at nu.validator.htmlparser.impl.MetaScanner.stateLoop(MetaScanner.java:398) at nu.validator.htmlparser.io.MetaSniffer.sniff(MetaSniffer.java:97) ... I simply fixed the code by checking that contentIndex, charsetIndex and httpEquivIndex are equal or greater than 0. Sorry, unable to give you a patch. These are the edited lines (starting 398 of MetaScanner.java): Line 398: if (contentIndex >= 0 && contentIndex < CONTENT.length && c == CONTENT[contentIndex]) { Line 403: if (charsetIndex >= 0 && charsetIndex < CHARSET.length && c == CHARSET[charsetIndex]) { Line 408: if (httpEquivIndex >= 0 && httpEquivIndex < HTTP_EQUIV.length && c == HTTP_EQUIV[httpEquivIndex]) {
Good catch! Fixed http://hg.mozilla.org/projects/htmlparser/rev/a2b48a25f665