JDK-4892631 : JPEG ImageReader does not validate the image indices with respect to Min Index
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 1.4.0,5.0,6,6u38,7,9,10,11,12,13,14
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic,linux
  • CPU: generic,arm
  • Submitted: 2003-07-18
  • Updated: 2021-07-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Duplicate :  
Description
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.

Comments
Test build: JDK11b23(CC-build(http://slc07hab.us.oracle.com/jdk_coverage/builds/11_23/jdk-11-instr_linux-x64_bin.tar.gz )) Platform :ubuntu18.04-x64 ute tool: tonga-4.0.2-rc2.jar Test case:2D_ImageIOTiger/ReaderInvalidIndexTest The case failed as the same issue refer to the log: http://sc11152645.us.oracle.com:8080/evergreen/results/11/b23/2d-cc/auto/ubuntu18.04-x64/results-2d-run1/ResultDir/ReaderInvalidIndexTest/ReaderInvalidIndexTest.log
07-08-2018

Please re-open if - if fix is in progress or on the plan to fix soon - if this is a P3 (file as P3, not P4)
14-03-2014