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

Bug in javax.sql.rowset.serial.SerialBlob.getBytes

XMLWordPrintable

    • b123
    • x86
    • windows_xp
    • Verified

      FULL PRODUCT VERSION :
      java version "1.6.0_03"
      Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
      Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      There is a bug in method javax.sql.rowset.serial.SerialBlob.getBytes.
      Exception is always generated if passed length is smaller than passed pos. The reason is that when position argument is bound checked, length argument is mistakenly used instead of len.

      Resolution:

      Instead of :

              if (pos < 1 || length - pos < 0 ) {
                  throw new SerialException("Invalid arguments: position cannot be less that 1");
              }

      write:

              if (pos < 1 || len - pos < 0 ) {
                  throw new SerialException("Invalid arguments: position cannot be less that 1");
              }



      REPRODUCIBILITY :
      This bug can be reproduced always.

            lancea Lance Andersen
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: