* Matthew Toseland <[email protected]> [2009-02-24 16:29:39]:
> On Friday 30 January 2009 15:43:34 [email protected] wrote: > > Author: nextgens > > Date: 2009-01-30 15:43:34 +0000 (Fri, 30 Jan 2009) > > New Revision: 25398 > > > > Modified: > > trunk/freenet/src/freenet/support/io/LineReadingInputStream.java > > Log: > > doh2! > > > > Modified: trunk/freenet/src/freenet/support/io/LineReadingInputStream.java > > =================================================================== > > --- trunk/freenet/src/freenet/support/io/LineReadingInputStream.java > 2009-01-30 15:21:49 UTC (rev 25397) > > +++ trunk/freenet/src/freenet/support/io/LineReadingInputStream.java > 2009-01-30 15:43:34 UTC (rev 25398) > > @@ -35,7 +35,7 @@ > > int ctr = 0; > > mark(maxLength + 2); // in case we have both a \r and a \n > > while(true) { > > - int x = read(buf, ctr, Math.min(1, buf.length - ctr)); > > + int x = read(buf, ctr, Math.max(1, buf.length - ctr)); > > This is bad. If it does anything (which I doubt), it will generate > ArrayIndexOutOfBounds'es. > > If this code is busy looping then there must be another reason for it. If > buf.length == ctr, then the buffer should be extended automatically, unless > buf.length == maxLength, in which case we should throw a TooLongException. > This won't happen if we read 0 bytes, but in that case we would have thrown > on the previous iteration. See r25844
signature.asc
Description: Digital signature
_______________________________________________ Devl mailing list [email protected] http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
