[OpenJDK 2D-Dev] RFR: 8270893: IndexOutOfBoundsException while reading large TIFF file [v2]

Sergey Bylokhov serb at openjdk.java.net
Tue Aug 3 19:06:30 UTC 2021


On Tue, 3 Aug 2021 09:11:07 GMT, Jayathirth D V <jdv at openjdk.org> wrote:

>> We are incorrectly passing source offset to ImageInputStream.readFully() which is getting used on destination buffer. streamPos maintained in each implementation of stream maintain's appropriate source offset while reading the data. Since we are completely utilizing destination buffer any offset greater than 0 would cause IOOBE. In our case we should use 0 as offset value.
>> 
>> Also to hit this code we need stream/file with at-least 1MB of IFD data, that's why there is no regression test. This change can be verified using image attached in JBS. All test run is green.
>
> Jayathirth D V has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Added regression test

Thank you! look fine.
BTW Looks like stream.readFully(unit, 0, sz) can be simplified to the stream.readFully(unit)?

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

Marked as reviewed by serb (Reviewer).

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


More information about the 2d-dev mailing list