RFR: 8364135: JPEGImageReader.getImageTypes() should throw exception for non-zero image index
Phil Race
prr at openjdk.org
Tue Jul 29 17:24:56 UTC 2025
On Tue, 29 Jul 2025 05:38:00 GMT, Jayathirth D V <jdv at openjdk.org> wrote:
> We need to throw appropriate exception when we pass invalid image index values to ImageReader.getImageTypes().
> We throw IOOBE in all other plugins except JPEG, Added appropriate check to throw IOOBE when JpegImageReader has invalid image index.
src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java line 907:
> 905: if (imageIndex != 0) {
> 906: throw new IndexOutOfBoundsException("imageIndex != 0!");
> 907: }
There are JPEG streams with > 1.
And elsewhere we handle it. Look at hasNextImage()
Is this method the sole place where -1 would not throw the right exception ?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26522#discussion_r2240495436
More information about the client-libs-dev
mailing list