--- old/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java 2014-06-09 22:28:40.747318200 +0400 +++ new/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java 2014-06-09 22:28:40.145241700 +0400 @@ -1256,7 +1256,11 @@ if (name.equals("IHDR")) { IHDR_width = getIntAttribute(node, "width"); IHDR_height = getIntAttribute(node, "height"); - IHDR_bitDepth = getEnumeratedAttribute(node, "bitDepth", + // IHDR_bitDepth is number of bits, not an index of IHDR_bitDepths + // getEnumeratedAttribute returns valid index of IHDR_bitDepths or + // IIOInvalidTreeException, to get real number of bits we need + // to do "1 << index". see 8041460 + IHDR_bitDepth = 1 << getEnumeratedAttribute(node, "bitDepth", IHDR_bitDepths); IHDR_colorType = getEnumeratedAttribute(node, "colorType", IHDR_colorTypeNames);