On Thu, 22 Jul 2021 05:48:44 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> Yi Yang has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   checkFromIndexSize(off, len,...)
>
> test/jdk/javax/imageio/ImageReaderReadAll.java line 94:
> 
>> 92:             if (seekForwardOnly) {
>> 93:                 if (imageIndex < minIndex)
>> 94:                     throw new IndexOutOfBoundsException();
> 
> Can't we use checkFromToIndex​ for this IOOBE too? Used in many other places 
> in this PR...
> 
> Please also confirm all tests modified are green after this modification..

checkFromToIndex​ has different semantice with checkIndex:

- checkFromToIndex

     * <ul>
     *  <li>{@code fromIndex < 0}</li>
     *  <li>{@code fromIndex > toIndex}</li>
     *  <li>{@code toIndex > length}</li>
     *  <li>{@code length < 0}, which is implied from the former 
inequalities</li>
     * </ul>

- checkIndex

     * <ul>
     *  <li>{@code index < 0}</li>
     *  <li>{@code index >= length}</li>
     *  <li>{@code length < 0}, which is implied from the former 
inequalities</li>
     * </ul>

---

The following tests are passed after applying this patch:

test/jdk/javax/imageio/AppletResourceTest.java
test/jdk/javax/imageio/ImageReaderReadAll.java
test/jdk/javax/imageio/metadata/IIOMetadataFormat/UserPluginMetadataFormatTest.java


ClippedImages.java is a manual test, I have no environment to test it, but 
since it's a trivial replacement, I think it's okay..

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

PR: https://git.openjdk.java.net/jdk/pull/4718

Reply via email to