drewnoakes/metadata-extractor
View on GitHubDeep recursion / stackoverflow with tiff image
Open
#559 opened on Dec 1, 2021
format-tiffhelp wantedimage-queue
Description
Hello.
Tiff image can be downloaded here: https://github.com/cgohlke/imagecodecs/blob/master/tests/tiff/gray.movie.u2.tif
Then try to extract metadata by using this code:
InputStream inputStream = new ByteArrayInputStream(imageBlob);
Metadata metadata = ImageMetadataReader.readMetadata(inputStream);
Directory mimeTypeDir = metadata.getFirstDirectoryOfType(FileTypeDirectory.class);
String mimeType = mimeTypeDir.getString(3);
String extension = mimeTypeDir.getString(4);
This should throw a java.lang.StackOverflowError
I also tried using a a tool like ExifTool and it threw a similar warning:
Deep recursion on subroutine "Image::ExifTool::ProcessDirectory"
Deep recursion on subroutine "Image::ExifTool::Exif::ProcessExif"
Let me know if you need more details.