Deep recursion / stackoverflow with tiff image
See original GitHub issueHello.
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.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to prevent maximum recursion runtime error in python ...
I tried to run my code in PyCharm, with python 2.7.15 and libtiff 0.4.2. I put the block with the TIFF.open statement in...
Read more >How to recursively and automatically convert all TIFs to an ...
I'm attempting to use GraphicsMagick in Ubuntu to convert hundreds of directories that contain multiple TIF files into one multi-page PDF ...
Read more >Stack overflow - Wikipedia
In software, a stack overflow occurs if the call stack pointer exceeds the stack bound. ... cause of stack overflow is excessively deep...
Read more >stack() in R does not include all .tiff files in my directory
In your code example evi <- list.files(files.evi, pattern = glob2rx("*MYD13Q1*.tif$"), full.names = TRUE). in the part after "pattern = .
Read more >Available CRAN Packages By Date of Publication
2022-12-03, endogeneity, Recursive Two-Stage Models to Address Endogeneity. 2022-12-03, ExpImage, Tool For Analysis of Images in Experiments.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Those tags are all in different IFDs. Please ignore my previous comment as I wasn’t aware of the exact TIFF structure but now I read some of the specification. I used a different tool to examine the structure of that tiff. It contains 65568 IFDs which is just too much for the default stack size. As the processing works in a recursive way this is just some kind of limitation.
@eriken You can work around this StackOverflowError by setting a bigger stack size for the VM e.g.
-Xss1g
. With that size I’m able to parse the TIFF using metadata-extractor.Not sure this is helpful: the file
gray.movie.u2.tif
contains more than 2^16 IFDs. Such files are not uncommon in bio-imaging. Some libraries (e.g. libtiff) can not access all IFDs because they use an uint16 counter.