[OpenJDK 2D-Dev] [9] RFR: JDK-8167278: ArrayIndexOutOfBoundsException when calling ImageIO.read(InputStream) with RLE4 BMP

Brian Burkhalter brian.burkhalter at oracle.com
Sat Jan 21 00:30:23 UTC 2017

On Jan 20, 2017, at 3:04 PM, Philip Race <philip.race at oracle.com> wrote:
>                     . Note: I couldn't create a suitable image with Delta encoding in image buffer. Hence this small change could not be tested.
Have you looked at image test suites such as http://bmptestsuite.sourceforge.net/?

> That is worrying me since I don't follow these lines are part of that:-
> 1684                     // Move to the position (xoff, yoff). Since l-is used
> 1685                     // to index into the scanline buffer, the calculation
> 1686                     // must be limited by the size
> 1687                     l += xoff + yoff*width;
> 1688                     l %= width;
> 1687 was already there but 1688 and the comment are new and 1688 looks wrong to me
> as it would seem to throw away the y it just added in ...

Indeed, if xoff is in the half-closed interval [0,width), then (xoff + yoff*width) % width == xoff.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20170120/7fc81d06/attachment.html>

More information about the 2d-dev mailing list