hMatoba / Piexif

Exif manipulation with pure python script.
MIT License
367 stars 81 forks source link

Corrupted EXIF causes memory leak #90

Open okor opened 5 years ago

okor commented 5 years ago

When attempting to read the EXIF data for some images, the python process using piexif will appear to hang and eventually will consume all available memory.

>>> im = Image.open("GettyImages_539746540.jpg")
>>> exif_dict = piexif.load(im.info["exif"])
Killed

^ The Killed message is happening because the code above is running in a docker container and gets killed when it exceeds it's memory boundary. On a server without docker, the process simply consumes all memory until the server crashes.

Here is an image with bad EXIF data which cause the issue above. GettyImages_539746540

I've also attached a zipped version, just in case Github processes images. GettyImages_539746540.jpg.zip

This library is used in the thumbor project so the bug described above is a huge problem.

okor commented 5 years ago

cc @hMatoba Please let me know if you intend to do any more work on this library. It's ok if you're not - but it would be helpful to know as soon as possible. Thanks!