Name: diC59631 Date: 09/03/97
Hi, I was looking over the source code for the java.io.InputStream and found a curious error in a bit mask used by the skip member function. The source is listed below.
public long skip(long n) throws IOException
{
/* ensure that the number is a positive int */
byte data[] = new byte[(int) (n & 0xEFFFFFFF)];
return read(data);
}
I believe that the mask 0xEFFFFFFF should in fact be 0x7FFFFFFF, as 0xEFFFFFFF won’t force the int n to become positive.
0xEFFFFFFF = 11101111111111111111111111111111 Binary
0x7FFFFFFF = 01111111111111111111111111111111 Binary
company - iDIDO Inc. , email - ###@###.###
======================================================================
- duplicates
-
JDK-4040408 java.io.InputStream.skip: Incorrect and inefficient
- Closed