--- old/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java 2017-12-13 14:47:27.852307000 +0530 +++ new/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java 2017-12-13 14:47:27.468115000 +0530 @@ -736,6 +736,17 @@ switch (chunkType) { case IDAT_TYPE: + /* + * 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 Header doesn't contain" + + " required PLTE chunk"); + } // If chunk type is 'IDAT', we've reached the image data. if (imageStartPosition == -1L) { /*