#255 StringIndexOutOfBoundsException when lexing a web page

open
nobody
None
5
2012-10-08
2011-10-06
Kim Ebert
No

Possible fix for lexer bug.

=== modified file 'jtidy/src/main/java/org/w3c/tidy/Lexer.java'
--- jtidy/src/main/java/org/w3c/tidy/Lexer.java 2010-05-06 23:18:10 +0000
+++ jtidy/src/main/java/org/w3c/tidy/Lexer.java 2010-11-02 02:18:59 +0000
@@ -1821,7 +1821,12 @@
if (TidyUtils.isLetter((char) c)) {
continue;
}
- matches = container.element.equalsIgnoreCase(TidyUtils.getString(lexbuf, start,
+ / Fix for bug #991 /
+ if ((start + container.element.length()) > lexsize)
+ matches = false;
+ / End Fix /
+ else
+ matches = container.element.equalsIgnoreCase(TidyUtils.getString(lexbuf, start,
container.element.length()));
if (matches) {
nested++;

Discussion