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