src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java
changeset 52742 b9f3606b2f83
parent 49995 6f595ec05539
child 52750 6bdbd601d31c
equal deleted inserted replaced
52741:d569b5e29021 52742:b9f3606b2f83
   466         metadata.iTXt_translatedKeyword.add(translatedKeyword);
   466         metadata.iTXt_translatedKeyword.add(translatedKeyword);
   467 
   467 
   468         String text;
   468         String text;
   469         pos = stream.getStreamPosition();
   469         pos = stream.getStreamPosition();
   470         int textLength = (int)(chunkStart + chunkLength - pos);
   470         int textLength = (int)(chunkStart + chunkLength - pos);
   471         if (textLength <= 0) {
   471         if (textLength < 0) {
   472             throw new IIOException("iTXt chunk length is not proper");
   472             throw new IIOException("iTXt chunk length is not proper");
   473         }
   473         }
   474         byte[] b = new byte[textLength];
   474         byte[] b = new byte[textLength];
   475         stream.readFully(b);
   475         stream.readFully(b);
   476 
   476 
   569     }
   569     }
   570 
   570 
   571     private void parse_tEXt_chunk(int chunkLength) throws IOException {
   571     private void parse_tEXt_chunk(int chunkLength) throws IOException {
   572         String keyword = readNullTerminatedString("ISO-8859-1", 80);
   572         String keyword = readNullTerminatedString("ISO-8859-1", 80);
   573         int textLength = chunkLength - keyword.length() - 1;
   573         int textLength = chunkLength - keyword.length() - 1;
   574         if (textLength <= 0) {
   574         if (textLength < 0) {
   575             throw new IIOException("tEXt chunk length is not proper");
   575             throw new IIOException("tEXt chunk length is not proper");
   576         }
   576         }
   577         metadata.tEXt_keyword.add(keyword);
   577         metadata.tEXt_keyword.add(keyword);
   578 
   578 
   579         byte[] b = new byte[textLength];
   579         byte[] b = new byte[textLength];
   667     }
   667     }
   668 
   668 
   669     private void parse_zTXt_chunk(int chunkLength) throws IOException {
   669     private void parse_zTXt_chunk(int chunkLength) throws IOException {
   670         String keyword = readNullTerminatedString("ISO-8859-1", 80);
   670         String keyword = readNullTerminatedString("ISO-8859-1", 80);
   671         int textLength = chunkLength - keyword.length() - 2;
   671         int textLength = chunkLength - keyword.length() - 2;
   672         if (textLength <= 0) {
   672         if (textLength < 0) {
   673             throw new IIOException("zTXt chunk length is not proper");
   673             throw new IIOException("zTXt chunk length is not proper");
   674         }
   674         }
   675         metadata.zTXt_keyword.add(keyword);
   675         metadata.zTXt_keyword.add(keyword);
   676 
   676 
   677         int method = stream.readUnsignedByte();
   677         int method = stream.readUnsignedByte();