|
|
home |
Bug in trans.CircularBuffer |
Emilia Dobkowska from Poland has found a bug in the implementation of the circular buffer, used by TCP.
The bug is the function retrieveBytes(): file jist.swans.trans.CircularBuffer.java:
byte[] data = new byte [retLength];
if ((buffer.length - head) < retLength)
{
int tempLength = buffer.length - head;
System.arraycopy (buffer, head, data, 0, tempLength);
//XXX changed by Emilia Dobkowska
//this line was here previously
//System.arraycopy (buffer, head, data, tempLength,retLength-tempLength);//this line should be instead
System.arraycopy (buffer, 0, data, tempLength, retLength-tempLength);
head = retLength - tempLength;
}
Gabriel Kliot
01/13/2009