2013/3/17 <ma...@apache.org>: > Author: markt > Date: Sun Mar 17 09:33:41 2013 > New Revision: 1457403 > > URL: http://svn.apache.org/r1457403 > Log: > There was a reason mark/reset was used here. Restore use of mark/reset and > add a comment. > > Modified: > tomcat/tc7.0.x/trunk/ (props changed) > > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > > Propchange: tomcat/tc7.0.x/trunk/ > ------------------------------------------------------------------------------ > Merged /tomcat/trunk:r1457402 > > Modified: > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > URL: > http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java?rev=1457403&r1=1457402&r2=1457403&view=diff > ============================================================================== > --- > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > (original) > +++ > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > Sun Mar 17 09:33:41 2013 > @@ -366,9 +366,12 @@ public class HttpParser { > private static String readTokenOrQuotedString(StringReader input, > boolean returnQuoted) throws IOException { > > + // Use mark/reset as skip(-1) fails when reading the last character > of > + // the input > + input.mark(1); > int c = input.read(); > - // Skip back so first character is available to be read again > - input.skip(-1); > + // Go back so first character is available to be read again > + input.reset(); > > if (c == '"') { > return readQuotedString(input, returnQuoted); >
I read the docs, but I missed this bug. Thanks for fixing. It was obvious that if (c==-1) then skip(-1) will fail. The issue that I missed and that is apparently fixed here is that if c was the last valid char of the string then skip(-1) will fail. I think this needs a test case (a 1-char token at the end of the string). There are also several other places where skip() is used in that class... Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org