ianare / exif-py

Easy to use Python module to extract Exif metadata from digital image files.
BSD 3-Clause "New" or "Revised" License
831 stars 191 forks source link

infinite loop for one rare image #161

Closed rom1504 closed 2 years ago

rom1504 commented 2 years ago

So I've been using your efficient lib to extract the exif of some 6 billion images and of course there were 2 images among them that couldn't simply work!

https://mls-east.iqcdn.net/mls_midtennessee/images/2119991/2119991_00.jpg here it is

import exifread
exifread.process_file(open("evil_image.jpg", "rb"), details=False)

results in an infinite loop

I'm trying to identify what could be causing it. Will PR if I do

Happens both with the last version released (2.3.2 and master)

rom1504 commented 2 years ago

investigation comment: getting stuck at list_ifd there https://github.com/ianare/exif-py/blob/2e95262b7cb55e1b1a871036039e995c042f8f5b/exifread/classes.py#L131

when I print i there, I'm getting this:

295
72
8
295
72
8

it seems there's a cycle of ifd in that file