RFR: 8364135: JPEGImageReader.getImageTypes() should throw exception for negative image index [v2]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Fri Aug 22 07:16:54 UTC 2025
On Thu, 21 Aug 2025 04:58:12 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.
>
> Jayathirth D V has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>
> - Update test to handle all regression cases
> - Add checks at other places also
> - Merge remote-tracking branch 'upstream/master' into jpeg_getImageTypes
> - Check only for negative index
> - 8364135: JPEGImageReader.getImageTypes() should throw exception for non-zero image index
src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java line 396:
> 394: private void checkNegativeImageIndex(int imageIndex) {
> 395: if (imageIndex < minIndex) {
> 396: throw new IndexOutOfBoundsException("imageIndex < " + minIndex);
Should we irrespectively throw IOBE or check for `seekForwardOnly` before throwing the exception
https://github.com/openjdk/jdk/blob/f423e1d9ad37135abacb8deb2d2151e21768a23e/src/java.desktop/share/classes/javax/imageio/ImageReader.java#L228-L235
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26522#discussion_r2292918680
More information about the client-libs-dev
mailing list