TMI-117: Fix for "componentId attribute out of range" issue.

This commit is contained in:
Harald Kuhr
2015-03-12 12:55:55 +01:00
parent 493edada59
commit 02a4277413
3 changed files with 66 additions and 1 deletions
@@ -1349,8 +1349,9 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
@Test
public void testInvalidDHTIssue() throws IOException {
// Image has JFIF with DHT that is okay on read, but not when you set back from tree...
// Image has JFIF, and DHT that is okay on read, but not when you set back from tree...
JPEGImageReader reader = createReader();
try {
reader.setInput(ImageIO.createImageInputStream(getClassLoaderResource("/jpeg/jfif-progressive-invalid-dht.jpg")));
@@ -1360,7 +1361,26 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
Node tree = metadata.getAsTree(metadata.getNativeMetadataFormatName());
assertNotNull(tree);
assertThat(tree, new IsInstanceOf(IIOMetadataNode.class));
}
finally {
reader.dispose();
}
}
@Test
public void testComponentIdOutOfRange() throws IOException {
// Image has JFIF, but SOF and SOS component ids are off, but not when you set back from tree...
JPEGImageReader reader = createReader();
try {
reader.setInput(ImageIO.createImageInputStream(getClassLoaderResource("/jpeg/jfif-component-id-out-of-range.jpg")));
IIOMetadata metadata = reader.getImageMetadata(0);
assertNotNull(metadata);
Node tree = metadata.getAsTree(metadata.getNativeMetadataFormatName());
assertNotNull(tree);
assertThat(tree, new IsInstanceOf(IIOMetadataNode.class));
}
finally {
reader.dispose();
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB