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

PNG Image Reader does not validate the image index passed to some of the methods

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 6
    • Component/s: client-libs
    • Subcomponent:
    • Introduced In Build:
      1.4
    • Introduced In Version:
    • Resolved In Build:
      b62
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      The API documentation for reader.getWidth(imgIndex), reader.getHeight(imgIndex), reader.getAspectRatio(imgIndex) claims that the above methods would throw an IndexOutOfBoundsException when the given image index is out of range. But this is not working for PNG ImageReader. PNG ImageReader returns the same width, height and aspect ratio regardless of what imageIndex is passed and the ImageIndex is not at all getting validated. This works fine for other readers such as GIF, JPEG and BMP. This gives an impression to the user that the image index specified by him exists in the input source even if it is out of range. This must be fixed and the exception must be thrown appropriately.

      This is noticed since JDK1.4+ on Win32 as well as Solaris platforms.

      I have attached a sample code. Execute the sample code as follows.
      java ImageReaderTest <img file>
      For Ex: java ImageReaderTest cup.png
      If you don't see any exception, the bug is reproduced.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                campbell Christopher Campbell (Inactive)
                Reporter:
                pmohansunw Praveen Mohan (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: