Skip to content
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

Handle invalid IFD #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

lhagan
Copy link

@lhagan lhagan commented Jun 12, 2013

I ran node-exif over about 6000 photos, and it got hung up on just one. In this case, it looks like the IFD was invalid, so whereas there would normally be a few IFD entires to loop over, node-exif detected over 10000. Not exactly an infinite loop, but it effectively approximates one. This is definitely a problem with the image; exiftool fails gracefully and reports: "Bad ExifIFD directory" when reading the same file.

I was able to quickly fix this by adding a sanity check: if the number of entries exceeds 1000, something's got to be wrong so I had it bail out. There's probably a better way to solve this problem, but I figured submitting a pull request would at least be a good way to bring attention to this edge case.

@gomfunkel
Copy link
Owner

Shame on me for taking this long for a reply but if I'm not totally mistaken the latest version 0.3.6 available from npm should fix this issue.

Please check your image again with this version. If it still doesn't work please attach the image causing the error to this issue so I can find a solution to the problem.

@lhagan
Copy link
Author

lhagan commented Jun 9, 2014

Sorry for taking so long to get back to you on this. I had misplaced the image in question, but finally tracked it down today. The problem still exists as of 0.4.0.
img_0026

@lacombar
Copy link

The patch is incorrect, AFAIK, there is nothing wrong with a >1000 entry IFD...

lacombar pushed a commit to aerilon/node-exif that referenced this pull request Feb 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants