New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cyclic directory references in EXIF data cause StackOverflowErrors #477
Comments
Hi Jeff, Thanks for reporting! I just made some change to the TIFF parsing that might help in this case (we no longer parse arbitrary nested IFDs), but I think the case may still happen for TIFF SubIFDs. This fix is currently only in my local branch, not in master or in the released 3.4.1. Hope to push it soon. Possibly related: #469 Do you happen to have a TIFF structure (or a JPEG containing an Exif segment) that has this problem, it would be very helpful if you could attach the file to the issue. Best regards, -- |
My guess for where it's infinite looping in the new version is https://github.com/haraldk/TwelveMonkeys/blob/master/imageio/imageio-metadata/src/main/java/com/twelvemonkeys/imageio/metadata/tiff/TIFFReader.java#L117-L128 Sample photo which breaks: http://www.danalog.org/images/exif-loop.jpg |
Thanks! I realized the fixed version is only local, so it isn't in the master branch yet, sorry... But I'll look into it! -- |
Finally had some time to look at this. Fixed. |
When you give TwelveMonkeys a JPEG with an EXIF directory that points to itself, you get a StackOverflowError:
This is line 133:
CompoundDirectory next = (CompoundDirectory) readDirectory(pInput, nextOffset, true);
You can see where another library solved this same issue: https://github.com/drewnoakes/metadata-extractor/blob/master/Source/com/drew/imaging/tiff/TiffReader.java#L112-L118
This is on 3.3.2, which is an old version. But if I upgrade locally to the latest version, it just hangs instead of stack overflowing.
The text was updated successfully, but these errors were encountered: