TMI-121: Fixed regression, introduced by filtering out Adobe/APP14 segments completely. Now makes sure the segments have the "expected" length 16, and anything after that is discarded.

This commit is contained in:
Harald Kuhr
2015-03-21 16:47:15 +01:00
parent 87777dfc2d
commit c4630d9eee
3 changed files with 120 additions and 33 deletions

View File

@@ -111,12 +111,15 @@ public class JPEGSegmentImageInputStreamTest {
ImageInputStream stream = new JPEGSegmentImageInputStream(ImageIO.createImageInputStream(getClassLoaderResource("/jpeg/no-image-types-rgb-us-web-coated-v2-ms-photogallery-exif.jpg")));
List<JPEGSegment> appSegments = JPEGSegmentUtil.readSegments(stream, JPEGSegmentUtil.APP_SEGMENTS);
assertEquals(1, appSegments.size());
assertEquals(2, appSegments.size());
assertEquals(JPEG.APP1, appSegments.get(0).marker());
assertEquals("Exif", appSegments.get(0).identifier());
// And thus, no JFIF, no Adobe, no XMP, no ICC_PROFILE or other segments
assertEquals(JPEG.APP14, appSegments.get(1).marker());
assertEquals("Adobe", appSegments.get(1).identifier());
// And thus, no JFIF, no XMP, no ICC_PROFILE or other segments
}
@Test