On Fri, 22 Aug 2025 07:13:45 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> 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

If `seekForwardOnly` is set to true and if we we have moved to `n` image, then 
getting details for `n-1` image should throw IOOBE. `minIndex` will be updated 
accordingly when `seekForwardOnly` is set to true, so nothing extra needs to be 
done from our side.

Naming the function as `checkNegativeImageIndex` is not right, so i have 
updated the function name.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26522#discussion_r2297660263

Reply via email to