Skip Menu |

This queue is for tickets about the Image-Info CPAN distribution.

Report information
The Basics
Id: 7442
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: Image-Info

People
Owner: TELS [...] cpan.org
Requestors: b.wheeler [...] ulcc.ac.uk
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.16
Fixed in: 1.20



Subject: Infinite loop of errors in Image::Info::TIFF
Under certain circumstances, Image::Info::TIFF seems to go into an infinite loop of errors, though I haven't managed to track down where the loop is yet. The cause is an incorrect self-call within process_ifds() at line 185 of Image/Info/TIFF.pm. Here is the context: if ($tn eq "ExifOffset") { # parse ExifSubIFD &process_ifds($info,$fh,$byteorder,$offset); } My guess is it should be &process_ifds($info,$fh,$page,$tagsseen,$byteorder,$offset); The missing 3rd and 4th arguments result in $byteorder being undef in the inside call, which leads to this error: Use of uninitialized value in string ne at /usr/local/lib/perl5/site_perl/5.8.0/Image/Info/TIFF.pm line 73. Then, I think because the function is being called inside an eval which doesn't appear to check whether it succeeded or not, it just goes round again and again. Possibly some additional error checking in my own code could avoid that, but equally how could I guess that an unexpected error in Image::Info would fail to halt? Ben
Could you please send me an example file which exhibits this problem? Thanx, Tels
Subject: Re: [rt.cpan.org #7442] Infinite loop of errors in Image::Info::TIFF
Date: Mon, 30 Jan 2006 18:34:44 +0000
To: via RT <bug-Image-Info [...] rt.cpan.org>
From: Ben Wheeler <b.wheeler [...] ulcc.ac.uk>
On Sat, Jan 28, 2006 at 06:59:46AM -0500, via RT wrote: Show quoted text
> Could you please send me an example file which exhibits this problem?
Strangely, after 1.5 years I don't still have the file. ;) But it's good to know someone has picked this up, thanks! I do still have some notes from when I discovered the bug. It was triggered by the presence of an ExifIFD tag http://www.awaresystems.be/imaging/tiff/tifftags/exififd.html which Image::Info attempts to parse by the incorrect recursive call as reported. According to my notes the particular file I used was created in Photoshop, so that might help you construct one, though not all files created in Photoshop have them and I don't know why this one did. There was nothing special about it, and I think any TIFF containing an ExifIFD block will trigger the bug. I have been successfully using the fix I mention in the original bug report. I have also fixed another couple of TIFF handling bugs I ran into which I didn't bother to report because Image::Info seemed to be unmaintained. 2004/10/01 BJW ~ Fixed "deep recursion" in Image::Info::TIFF when processing multi-page TIFF files, by replacing process_ifds recursion for each directory with iteration. 2004/10/01 BJW ~ Fixed logic of process_ifds, which previously failed to catch certain conditions or was just plain wrong. * Wrote t/tiff.t, testing a multi-page tiff in img/test.tif (By "just plain wrong" I mean it did not agree with the TIFF standard). I'm afraid I can't extract separate patches for these but I have attached a combined patch against 1.16. I've been using this patched version since 2004 to process quite a high volume of TIFF files created by various packages, and haven't run into any problems with it. I also attach a new test program which should go in ./t, and a multi-page TIFF file to go in ./img which is used by the test program. Hope this is helpful. Regards, Ben

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

Download test.tif
image/tiff 2.7k

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #7442] Infinite loop of errors in Image::Info::TIFF
Date: Mon, 30 Jan 2006 21:01:43 +0100
To: bug-Image-Info [...] rt.cpan.org
From: Tels <nospam-abuse [...] bloodgate.com>
Moin, On Monday 30 January 2006 19:35, b.wheeler@ulcc.ac.uk via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=7442 > > > On Sat, Jan 28, 2006 at 06:59:46AM -0500, via RT wrote:
> > Could you please send me an example file which exhibits this problem?
> > Strangely, after 1.5 years I don't still have the file. ;) But it's > good to know someone has picked this up, thanks!
I now maintain Image::Info since I am using it for something and Gisle hasn't gotten the time for it anymore. So don't expect miracle from me :) Show quoted text
> I do still have some notes from when I discovered the bug.
[snip explanations] I will look at this for 1.18, which will not happen before the weekend - but many thanx for the info and patches etc. Best wishes, Tels -- Signed on Mon Jan 30 21:00:18 2006 with key 0x93B84C15. Visit my photo gallery at http://bloodgate.com/photos/ PGP key on http://bloodgate.com/tels.asc or per email. "...no one would risk manipulating votes in an election because it's against the law and carries a heavy penalty..." -- Diebold spokesman David Bear
Download (untitled)
application/pgp-signature 481b

Message body not shown because it is not plain text.

On Mon Jan 30 13:35:49 2006, b.wheeler@ulcc.ac.uk wrote: Show quoted text
> On Sat, Jan 28, 2006 at 06:59:46AM -0500, via RT wrote:
> > Could you please send me an example file which exhibits this problem?
Oh boy, I just released 1.18 after tracking many hours bugs in the EXIF parsing code and I totally forgot about your problem :( In any event, I am now really considering just using Image::Exiftool to extract the EXIF data, since the code in Image::Info is quite a mess and incomplete/out-of-date. F.i., I added some Panasonic stuff, but quite a lot of other manufacturers/models are still missing. Hopefully I will find some energy to do this on this weekend. Sorry about the delays, Tels
On Mon Jan 30 13:35:49 2006, b.wheeler@ulcc.ac.uk wrote: Show quoted text
> On Sat, Jan 28, 2006 at 06:59:46AM -0500, via RT wrote:
> > Could you please send me an example file which exhibits this problem?
> > Strangely, after 1.5 years I don't still have the file. ;) But it's > good to know someone has picked this up, thanks!
:) I applied your patch, added the test.tif and t/tiff.t files. In addition, I rewrote the test to use Test::More, the my_foo private functions to be _foo (to make Pod::Test happy with no extra work), added a POD and added Info/TIFF.pm to t/pod_cov.t. The test fail with 1.18 and pass with 1.19, so hopefully this will fix both this bug and https://rt.cpan.org/Ticket/Display.html?id=3698 . Best wishes, Tels
On Mon Jan 30 13:35:49 2006, b.wheeler@ulcc.ac.uk wrote: Show quoted text
> On Sat, Jan 28, 2006 at 06:59:46AM -0500, via RT wrote:
> > Could you please send me an example file which exhibits this problem?
> > Strangely, after 1.5 years I don't still have the file. ;) But it's > good to know someone has picked this up, thanks!
:) I applied your patch, added the test.tif and t/tiff.t files. In addition, I rewrote the test to use Test::More, the my_foo private functions to be _foo (to make Pod::Test happy with no extra work), added a POD and added Info/TIFF.pm to t/pod_cov.t. The test fail with 1.18 and pass with 1.19, so hopefully this will fix both this bug and https://rt.cpan.org/Ticket/Display.html?id=3698 . Best wishes, Tels
Subject: Re: [rt.cpan.org #7442] Infinite loop of errors in Image::Info::TIFF
Date: Mon, 6 Mar 2006 09:49:32 +0000
To: via RT <bug-Image-Info [...] rt.cpan.org>
From: Ben Wheeler <b.wheeler [...] ulcc.ac.uk>
On Sun, Mar 05, 2006 at 04:16:40AM -0500, via RT wrote: Show quoted text
> The test fail with 1.18 and pass with 1.19, so hopefully this will fix > both this bug and https://rt.cpan.org/Ticket/Display.html?id=3698 .
Great news Tels, thanks very much.