United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4892630 : PNG Image Reader does not validate the image index passed to some of the methods

Details
Type:
Bug
Submit Date:
2003-07-18
Status:
Closed
Updated Date:
2006-11-06
Project Name:
JDK
Resolved Date:
2005-11-21
Component:
client-libs
OS:
generic
Sub-Component:
javax.imageio
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:

Related Reports
Relates:

Sub Tasks

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.

                                    

Comments
EVALUATION

Simple fix; should try to get it in for RC.
                                     
2005-10-25



Hardware and Software, Engineered to Work Together