Hello All,

 

Please review the following fix in JDK10 :

 

Bug : https://bugs.openjdk.java.net/browse/JDK-8191431 

Webrev : http://cr.openjdk.java.net/~jdv/8191431/webrev.00/ 

 

Issue : When we try to read multiple PNG images with different IDAT chunk 
positions using the same PNGImageReader instance we get "IIOException: Error 
reading PNG image data".

 

Root cause : Issue is happening because of changes present in HYPERLINK 
"https://bugs.openjdk.java.net/browse/JDK-8164971"JDK-8164971.

                Under HYPERLINK 
"https://bugs.openjdk.java.net/browse/JDK-8164971"JDK-8164971 we have made 
changes such that imageStartPosition for IDAT chunk will be updated only once 
for a given PNGImageReader instance while reading metadata.

                case IDAT_TYPE:

                    // If chunk type is 'IDAT', we've reached the image data.

                    if (imageStartPosition == -1L) {

                        /*

                         * PNGs may contain multiple IDAT chunks containing

                         * a portion of image data. We store the position of

                         * the first IDAT chunk and continue with iteration

                         * of other chunks that follow image data.

                         */

                        imageStartPosition = stream.getStreamPosition() - 8;

                   }

 

                When we use same PNGImageReader instance to read another PNG 
image and if IDAT chunk position and length differs we will get IIOException.

 

Solution : We already have resetStreamSettings() method which we call when user 
tries to decode an image under ImageReader.setInput(). In resetStreamSettings() 
function if we initialize imageStartPosition to '-1L' it will resolve this 
issue.

 

Thanks,

Jay

 

Reply via email to