Buggy code:
private boolean emptyAsNull = false ; private boolean ignoreEmptyTokens = true ; public static StrTokenizer . Matcher createCharSetMatcher ( char [ ] chars ) { } public static StrTokenizer . Matcher createCharSetMatcher ( String chars ) { } public static StrTokenizer . Matcher createCharMatcher ( char ch ) { } public static StrTokenizer . Matcher createStringMatcher ( String str ) { } private static StrTokenizer getCSVClone ( ) { } public static StrTokenizer getCSVInstance ( ) { } public static StrTokenizer getCSVInstance ( String input ) { } public static StrTokenizer getCSVInstance ( char [ ] input ) { } private static StrTokenizer getTSVClone ( ) { } public static StrTokenizer getTSVInstance ( ) { } public static StrTokenizer getTSVInstance ( String input ) { } public static StrTokenizer getTSVInstance ( char [ ] input ) { } public StrTokenizer ( ) { } public StrTokenizer ( String input ) { } public StrTokenizer ( String input , char delim ) { } public StrTokenizer ( String input , String delim ) { } public StrTokenizer ( String input , StrTokenizer . Matcher delim ) { } public StrTokenizer ( String input , char delim , char quote ) { } public StrTokenizer ( String input , StrTokenizer . Matcher delim , StrTokenizer . Matcher quote ) { } public StrTokenizer ( char [ ] input ) { } public StrTokenizer ( char [ ] input , char delim ) { } public StrTokenizer ( char [ ] input , String delim ) { } public StrTokenizer ( char [ ] input , StrTokenizer . Matcher delim ) { } public StrTokenizer ( char [ ] input , char delim , char quote ) { } public StrTokenizer ( char [ ] input , StrTokenizer . Matcher delim , StrTokenizer . Matcher quote ) { } public int size ( ) { } public String nextToken ( ) { } public String previousToken ( ) { } public String [ ] getAllTokens ( ) { } public void reset ( ) { } public void reset ( String input ) { } public void reset ( char [ ] input ) { } public boolean hasNext ( ) { } public Object next ( ) { } public int nextIndex ( ) { } public boolean hasPrevious ( ) { } public Object previous ( ) { } public int previousIndex ( ) { } public void remove ( ) { } public void set ( Object obj ) { } public void add ( Object obj ) { } private void tokenize ( ) { } private String [ ] readTokens ( ) { } private void addToken ( List list , String tok ) { } private int readNextToken ( int start , char [ ] cbuf , StringBuffer token ) { } private int readQuoted ( int start , char [ ] cbuf , StringBuffer token ) { } private int readUnquoted ( int start , StringBuffer token ) { } public StrTokenizer . Matcher getDelimiterMatcher ( ) { } public void setDelimiterMatcher ( StrTokenizer . Matcher delim ) { } public void setDelimiterChar ( char delim ) { } public void setDelimiterString ( String delim ) { } public StrTokenizer . Matcher getQuoteMatcher ( ) { } public void setQuoteMatcher ( StrTokenizer . Matcher quote ) { } public void setQuoteChar ( char quote ) { } public StrTokenizer . Matcher getIgnoredMatcher ( ) { } public void setIgnoredMatcher ( StrTokenizer . Matcher ignored ) { } public void setIgnoredChar ( char ignored ) { } public StrTokenizer . Matcher getTrimmerMatcher ( ) { } public void setTrimmerMatcher ( StrTokenizer . Matcher trimmer ) { } public boolean isEmptyTokenAsNull ( ) { } public void setEmptyTokenAsNull ( boolean emptyAsNull ) { } public boolean isIgnoreEmptyTokens ( ) { } public void setIgnoreEmptyTokens ( boolean ignoreEmptyTokens ) { } public String getContent ( ) { } public Object clone ( ) { } public static interface Matcher { int isMatch ( char [ ] text , int textLen , int pos ) ; } public static final class CharSetMatcher implements StrTokenizer . Matcher { private char [ ] chars ; public CharSetMatcher ( char [ ] chars ) { } public int isMatch ( char [ ] text , int textLen , int pos ) { return ( Arrays . binarySearch ( chars , text [ pos ] ) ) >= 0 ? 1 : 0 ; } } static final class CharMatcher implements StrTokenizer . Matcher { private char ch ; CharMatcher ( char ch ) { } public int isMatch ( char [ ] text , int textLen , int pos ) { return ( ch ) == ( text [ pos ] ) ? 1 : 0 ; } } static final class StringMatcher implements StrTokenizer . Matcher { private char [ ] chars ; StringMatcher ( String str ) { } public int isMatch ( char [ ] text , int textLen , int pos ) { int len = chars . length ; <START_BUG> if ( ( pos + len ) >= textLen ) { <END_BUG> return 0 ; } for ( int i = 0 ; i < ( chars . length ) ; i ++ , pos ++ ) { if ( ( chars [ i ] ) != ( text [ pos ] ) ) { return 0 ; } } return len ; } } static final class NoMatcher implements StrTokenizer . Matcher { NoMatcher ( ) { } public int isMatch ( char [ ] text , int textLen , int pos ) { return 0 ; } } static final class TrimMatcher implements StrTokenizer . Matcher { TrimMatcher ( ) { } public int isMatch ( char [ ] text , int textLen , int pos ) { return ( text [ pos ] ) <= 32 ? 1 : 0 ; } } }

Fix:
if ( ( pos + len ) > textLen ) {