< prev index next >
src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java
Print this page
*** 466,476 ****
metadata.iTXt_translatedKeyword.add(translatedKeyword);
String text;
pos = stream.getStreamPosition();
int textLength = (int)(chunkStart + chunkLength - pos);
! if (textLength <= 0) {
throw new IIOException("iTXt chunk length is not proper");
}
byte[] b = new byte[textLength];
stream.readFully(b);
--- 466,476 ----
metadata.iTXt_translatedKeyword.add(translatedKeyword);
String text;
pos = stream.getStreamPosition();
int textLength = (int)(chunkStart + chunkLength - pos);
! if (textLength < 0) {
throw new IIOException("iTXt chunk length is not proper");
}
byte[] b = new byte[textLength];
stream.readFully(b);
*** 569,579 ****
}
private void parse_tEXt_chunk(int chunkLength) throws IOException {
String keyword = readNullTerminatedString("ISO-8859-1", 80);
int textLength = chunkLength - keyword.length() - 1;
! if (textLength <= 0) {
throw new IIOException("tEXt chunk length is not proper");
}
metadata.tEXt_keyword.add(keyword);
byte[] b = new byte[textLength];
--- 569,579 ----
}
private void parse_tEXt_chunk(int chunkLength) throws IOException {
String keyword = readNullTerminatedString("ISO-8859-1", 80);
int textLength = chunkLength - keyword.length() - 1;
! if (textLength < 0) {
throw new IIOException("tEXt chunk length is not proper");
}
metadata.tEXt_keyword.add(keyword);
byte[] b = new byte[textLength];
*** 667,677 ****
}
private void parse_zTXt_chunk(int chunkLength) throws IOException {
String keyword = readNullTerminatedString("ISO-8859-1", 80);
int textLength = chunkLength - keyword.length() - 2;
! if (textLength <= 0) {
throw new IIOException("zTXt chunk length is not proper");
}
metadata.zTXt_keyword.add(keyword);
int method = stream.readUnsignedByte();
--- 667,677 ----
}
private void parse_zTXt_chunk(int chunkLength) throws IOException {
String keyword = readNullTerminatedString("ISO-8859-1", 80);
int textLength = chunkLength - keyword.length() - 2;
! if (textLength < 0) {
throw new IIOException("zTXt chunk length is not proper");
}
metadata.zTXt_keyword.add(keyword);
int method = stream.readUnsignedByte();
< prev index next >