[OpenJDK 2D-Dev] Review request for JDK-6967419 : IndexOutOfBoundsException when drawing PNGs

prasanta sadhukhan prasanta.sadhukhan at oracle.com
Fri Nov 6 09:15:27 UTC 2015

Hi Jay,

looks ok but
I guess you need to do the same for finish() method too in similar way 
you did for finishChunk() as finish() is called from write_IHDR, 
write_CHRM etc and it calls flushBefore().
Also, I guess you should not consume IOB Exception and let it be thrown 
to user instead of RuntimeException after catching IOBE.

On 11/5/2015 5:25 PM, Jayathirth D V wrote:
> Hello All,
> Please review following fix in jdk9:
> Bug : https://bugs.openjdk.java.net/browse/JDK-6967419
> Webrev : http://cr.openjdk.java.net/~rchamyal/jay/6967419/webrev.00/
> Bug : IndexOutOfBoundsException when drawing PNGs
> Root cause : When user intentionally throws IO Exception while write 
> is happening.
>                           We call ios.finish() in finally block of 
> write_IDAT() which internally goes to finishChunk(). But the startPos 
> of the chunk is still pointing to present IDAT chunk but 
> flushedPos(streamPos) is pointing to end of  IDAT chunk.
>                           So in finishChunk(), startPos will be less 
> than flushedPos. This is causing IndexOutOfBoundException in 
> stream.seek() and cache is not closed.
> Solution : If IOException is thrown by user, catch the exception while 
> write is happening and update startPos to streamPos. So that when 
> seek() happens in finishChunk() we don’t see IndexOutOfBoundsException 
> and cache is closed properly.
> Thanks,
> Jay

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

More information about the 2d-dev mailing list