drewnoakes/metadata-extractor

Deep recursion / stackoverflow with tiff image

Open

#559 aberto em 1 de dez. de 2021

Ver no GitHub
 (5 comments) (1 reaction) (0 assignees)Java (470 forks)batch import
format-tiffhelp wantedimage-queue

Métricas do repositório

Stars
 (2.411 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

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.

Guia do colaborador