--- old/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java 2017-12-26 13:08:35.253487000 +0530 +++ new/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java 2017-12-26 13:08:34.341031000 +0530 @@ -739,6 +739,17 @@ // If chunk type is 'IDAT', we've reached the image data. if (imageStartPosition == -1L) { /* + * The PNG specification mandates that if colorType is + * PNG_COLOR_PALETTE then the PLTE chunk should appear + * before the first IDAT chunk. + */ + if (colorType == PNG_COLOR_PALETTE && + !(metadata.PLTE_present)) + { + throw new IIOException("Required PLTE chunk" + + " missing"); + } + /* * 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