mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-13 00:18:59 +00:00
8144997: "IIOException: Field data is past end-of-stream" when calling TIFFImageReader.read()
Instead of failing for an IFD entry with bad type or offset, continue with the next entry. Reviewed-by: prr
This commit is contained in:
parent
5b1765f25d
commit
a3e2ce543c
@ -475,9 +475,10 @@ public class TIFFIFD extends TIFFDirectory {
|
||||
int sizeOfType;
|
||||
try {
|
||||
sizeOfType = TIFFTag.getSizeOfType(type);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new IIOException("Illegal type " + type
|
||||
+ " for tag number " + tagNumber, e);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
// Continue with the next IFD entry.
|
||||
stream.skipBytes(4);
|
||||
continue;
|
||||
}
|
||||
int count = (int)stream.readUnsignedInt();
|
||||
|
||||
@ -524,7 +525,7 @@ public class TIFFIFD extends TIFFDirectory {
|
||||
|
||||
// Check whether the the field value is within the stream.
|
||||
if (haveStreamLength && offset + size > streamLength) {
|
||||
throw new IIOException("Field data is past end-of-stream");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add a TIFFIFDEntry as a placeholder. This avoids a mark,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user