On Tue, 29 Jul 2025 05:38:00 GMT, Jayathirth D V <j...@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