[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-classpath] [Bug classpath/23236] New: bug in ObjectInputStream
From: |
jonathan dot shore at us dot hsbc dot com |
Subject: |
[bug-classpath] [Bug classpath/23236] New: bug in ObjectInputStream |
Date: |
4 Aug 2005 19:54:42 -0000 |
Bug caused garbled data to return when buffer is refreshed in certain
circumstances:
- data item to be read spans two buffers (not enough bytes in current)
Bug is caused by:
- return value "length" is not the amount of bytes read, rather the length minus
amount read in previous buffer, should be total amount read
Fixed function as follows:
public int read(byte[] data, int offset, int length) throws IOException
{
int read = 0;
if (this.readDataFromBlock)
{
if (this.blockDataPosition + length > this.blockDataBytes)
{
int remain = this.blockDataBytes - this.blockDataPosition;
if (remain != 0)
{
System.arraycopy(this.blockData, this.blockDataPosition,
data, offset, remain);
offset += remain;
length -= remain;
read += remain;
}
readNextBlock ();
}
// technically should check to see whether length bytes are available
(possible
bug)
System.arraycopy(this.blockData, this.blockDataPosition,
data, offset, length);
this.blockDataPosition += length;
read += length;
return read;
}
else
return this.realInputStream.read(data, offset, length);
}
--
Summary: bug in ObjectInputStream
Product: classpath
Version: unspecified
Status: UNCONFIRMED
Severity: critical
Priority: P1
Component: classpath
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jonathan dot shore at us dot hsbc dot com
CC: bug-classpath at gnu dot org
GCC build triplet: HEAD
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23236
- [bug-classpath] [Bug classpath/23236] New: bug in ObjectInputStream,
jonathan dot shore at us dot hsbc dot com <=