-
Bug
-
Resolution: Unresolved
-
P4
-
1.4.0, 5.0, 6, 6u38, 7, 9, 10, 11, 12, 13, 14
-
generic, arm
-
generic, linux
The API doc for reader.getWidth(), getHeight(), read() and getAspectRatio() claims that the above methods must throw an IndexOutOfBoundsException when the given image index is invalid. This seems to work fine for the read method. But for other methods, when the given index is less than 0 (or less than Min Index) no validation take place. The aspect ratio is returned as 'NaN' and width, height are 0. Actually the JPEG ImageReader must validate the image index on the positive as well as negative sides as GIF reader does. Hence it must throw an exception when the image index is less than 0 and this happens fine in the case of read method where the given index is validated against the min index.
This is reproducible since JDK1.4+ on win32 as well as Solaris platforms.
I have attached a sample code. Execute the sample code and pass the image file as follows:
java ImageReaderTest flower.jpg
if you don't see any exception then the bug is reproduced. Try with other image types such as GIF and compare the behavior.
This is reproducible since JDK1.4+ on win32 as well as Solaris platforms.
I have attached a sample code. Execute the sample code and pass the image file as follows:
java ImageReaderTest flower.jpg
if you don't see any exception then the bug is reproduced. Try with other image types such as GIF and compare the behavior.
- duplicates
-
JDK-6410864 ImageReader-s returned from ImageIO.getImageReaders() doesn't follow spec
- Closed