Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4076231

source code error in bit mask.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.3
    • core-libs
    • None
    • x86
    • windows_95



      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 - ###@###.###
      ======================================================================

            mr Mark Reinhold
            dindrigo Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: