mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 04:25:29 -04:00
Merge pull request #217 from Schmidor/tiffreader_eof
Catch EOF at reading IFD pointer
This commit is contained in:
commit
ed434dfb1d
@ -119,7 +119,13 @@ public final class EXIFReader extends MetadataReader {
|
||||
|
||||
if (readLinked) {
|
||||
if (nextOffset == -1) {
|
||||
nextOffset = pInput.readUnsignedInt();
|
||||
try {
|
||||
nextOffset = pInput.readUnsignedInt();
|
||||
}
|
||||
catch (EOFException e) {
|
||||
// catch EOF here as missing EOF marker
|
||||
nextOffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Read linked IFDs
|
||||
|
@ -276,4 +276,13 @@ public class EXIFReaderTest extends MetadataReaderAbstractTest {
|
||||
assertNotNull(interop);
|
||||
assertEquals(0, interop.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadExifWithMissingEOFMarker() throws IOException {
|
||||
ImageInputStream stream = ImageIO.createImageInputStream(getResource("/exif/noeof.tif"));
|
||||
CompoundDirectory directory = (CompoundDirectory) createReader().read(stream);
|
||||
assertEquals(15, directory.size());
|
||||
assertEquals(1, directory.directoryCount());
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
|
BIN
imageio/imageio-metadata/src/test/resources/exif/noeof.tif
Normal file
BIN
imageio/imageio-metadata/src/test/resources/exif/noeof.tif
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user