mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-04-30 00:00:01 -04:00
TMI-20: Made the EXIFReader more lenient about bad directory entry count.
This commit is contained in:
+14
@@ -161,4 +161,18 @@ public class EXIFReaderTest extends MetadataReaderAbstractTest {
|
||||
assertNotNull(entry);
|
||||
assertEquals(Rational.NaN, entry.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBadDirectoryCount() throws IOException {
|
||||
// This image seems to contain bad Exif. But as other tools are able to read, so should we..
|
||||
ImageInputStream stream = ImageIO.createImageInputStream(getResource("/jpeg/exif-bad-directory-entry-count.jpg"));
|
||||
stream.seek(4424 + 10);
|
||||
|
||||
Directory directory = createReader().read(new SubImageInputStream(stream, 214 - 6));
|
||||
assertEquals(7, directory.size()); // TIFF structure says 8, but the last entry isn't there
|
||||
|
||||
Directory exif = (Directory) directory.getEntryById(TIFF.TAG_EXIF_IFD).getValue();
|
||||
assertNotNull(exif);
|
||||
assertEquals(3, exif.size());
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
Reference in New Issue
Block a user