Public bug reported:

Binary package hint: libimage-info-perl

Image::Info in perl sometime crashes on JPEG-files while trying to get
EXIF info.

I'm using Image::Info in perl to get EXIF-info from some images. Some JPEG 
images created with ufraw 0.10
from RAW-format seem to trigger a crash in the JPEG-module of Image::Info.

To be more specific, it crashes on line 54 in my_read with a "short read"
when it tries to read 2 bytes, but finds 0.

I have tracked the bug and found that it has something to do with a built
in thumbnail.

In process_app1_exif it's trying to recursively process the thumbnail, and
it sets a variable $jdata to point to the data representing the thumbnail
and process that with a "with_io_string". In my case, $jdata is an empty
string, and when _process_file tries to read 2 bytes from the header of
that file, it crashes.

I fixed this on my machine by adding a check around with_io_string to see
if this string is empty before processing it. It seems to work fine, but
my knowledge of the JPEG-standard is limited at best.. :)

I'm using Image::Info in perl to get EXIF-info from some images. I
recently started using ufraw 0.10 to convert from my cameras RAW-format to
JPEG, and it seems to trigger a crash in the JPEG-module of Image::Info.

To be more specific, it crashes on line 54 in my_read with a "short read"
when it tries to read 2 bytes, but finds 0.

I have tracked the bug and found that it has something to do with a built
in thumbnail.

In process_app1_exif it's trying to recursively process the thumbnail, and
it sets a variable $jdata to point to the data representing the thumbnail
and process that with a "with_io_string". In my case, $jdata is an empty
string, and when _process_file tries to read 2 bytes from the header of
that file, it crashes.

I fixed this on my machine by adding a check around with_io_string to see
if this string is empty before processing it. It seems to work fine, but
my knowledge of the JPEG-standard is limited at best.. :)

Here's the patch I made:

--- JPEG.pm.original    2007-04-07 12:59:46.000000000 +0200
+++ JPEG.pm     2007-10-09 14:22:32.000000000 +0200
@@ -272,9 +272,11 @@
                my $jdata = substr($data, $ipos, $ilen);
                #$info->push_info($i, "JPEGImage" => $jdata);
 
-               with_io_string {
-                   _process_file($info, $_, $i);
-               } $jdata;
+               if (defined $jdata && $jdata ne "") {
+                   with_io_string {
+                      _process_file($info, $_, $i);
+                   } $jdata;
+                }
            }
        }

** Affects: libimage-info-perl (Ubuntu)
     Importance: Undecided
         Status: New

-- 
Can't parse image info: short read (2/0) at /usr/share/perl5/Image/Info/JPEG.pm 
line 54.
https://bugs.launchpad.net/bugs/150952
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to