Exiftool hanging

Started by llazon, March 05, 2025, 10:25:29 PM

Previous topic - Next topic

llazon

Hi Phil, I came across an image, looks like from an older Nokia phone that is causing Exiftool to hang.  Through my amateur debugging with Perl, looks like it gets stuck in a loop reading tags.

Image::ExifTool::SetupTagTable(/usr/share/perl5/Image/ExifTool.pm:5801):
5801:         foreach $tagInfo (@infoArray) {

As I don't have permission to share publicly, I will send this image via email.

Originally found with Exiftool 13.18, but verified it is an issue with 13.22 as well.  On Linux and Mac.

Thanks!

Lee

Phil Harvey

#1
Hi Lee,

Thanks for this report but I am not able to reproduce the issue.  The command "exiftool FILE" works normally on this file for version 13.18, 13.22 and the current version of ExifTool.  This is on MacOS so it should be the same as you.

What is the output of "exiftool -v -ver" on your system?  My worry is that this could be a Perl bug.  I'm running Perl 5.018004.

There are a number of issues with the metadata in this image, including improperly written XMP, but nothing I can see that should cause  a hang.  However, there is a large extended XMP that could potentially cause issues if the memory isn't handled properly.

But the code you mention isn't reading tags from the file -- it is setting up the standard pre-defined tags in the internal tables.

- Phil

Edit:  I am able to reproduce this issue using Perl 5.026003.  -- I'll let you know when I find a solution.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Looking more closely, the XMP is badly corrupted past a certain point, which is triggering a Perl bug when parsing this data.

I have implemented a patch to avoid this hang, and ExifTool 13.23 shouldn't exhibit this problem.

Thanks again for this report.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

llazon

Awesome, we always appreciate your time and quick responses! 

Just for reference, on my Mac I am running Perl v5.34.1.  On Linux v5.34.0.

I'll keep an eye out for ExifTool 13.23.

Thanks again!

Lee


Phil Harvey

Just for reference, I've experience bugs like this in other versions of Perl.  The problem occurs if you have a capture in a regex expression that captures something too large.  In this case the corrupted XMP was about 5MB and the capture size could have been around a MB or so.  I blame Adobe for pioneering the nonsensical strategy of putting image data in XMP, which is why the XMP was so large in the first place.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Version 13.23 is now available.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).