After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 466044 - JPEG plug-in crashes while opening image with Olympus MakerNote (bug in libexif)
JPEG plug-in crashes while opening image with Olympus MakerNote (bug in libexif)
Status: RESOLVED NOTGNOME
Product: GIMP
Classification: Other
Component: Plugins
2.2.x
Other All
: Normal critical
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
: 474024 496067 531564 555616 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-08-12 19:17 UTC by Robert F. Chapman
Modified: 2008-11-11 20:54 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Robert F. Chapman 2007-08-12 19:17:31 UTC
Steps to reproduce:
1. open a .jpg file and GIMP crashes the machine by using all memory.
2. reproducible only on certain images, but is consistent with the image
3. 


Stack trace:
N/A

Other information:
I have several images that cause this behaivior with GIMP. I'm trying other options and also trying a new desktop session, as the one I'm using is from my older 64bit fedora 6 install.

I can upload one of the offending files if needed
Comment 1 Martin Nordholts 2007-08-12 19:21:59 UTC
Yes please, attach the smallest offending file you have.
Comment 2 Robert F. Chapman 2007-08-12 19:57:05 UTC
Is there a place I can upload the file to..  It's 3.7 Mb and is the only image I would want to submit for testing at this time.

I tried to upload the image to a free hosting site, but, they modified the image.

Comment 3 Raphaël Quinet 2007-08-12 21:33:57 UTC
Use the link "Create a New Attachment" just below the comment box.

It is very likely that the crash is due to an old bug in libexif that has been fixed some time ago, but please attach the image anyway so that we can be sure.
Comment 4 Robert F. Chapman 2007-08-13 04:49:44 UTC
I get the message below when I try to upload it.  I tried to compress it but no luck.  I can't seem to find a place that will accept this size file.

File Too Large
The file you are trying to attach is 3768 kilobytes (KB) in size. Non-patch attachments cannot be more than1000 KB.
We recommend that you store your attachment elsewhere on the web, and then insert a link to it in a comment, or in the URL field for this bug. Alternately, if your attachment is an image, you could convert it to a compressible format like JPG or PNG and try again.
Comment 5 Martin Nordholts 2007-08-13 05:59:10 UTC
I have never tried http://bayimg.com/ myself, but they seem to have a generous file size limit, so you could try to upload your image there.
Comment 6 Robert F. Chapman 2007-08-13 06:11:16 UTC
That worked... I hope the image is not altered so the error does not crop up.  I'll try downloading the image and see if it is still re-producible.

here is the Image:

http://bayimg.com/lAfpfaABi 
Comment 7 Robert F. Chapman 2007-08-13 06:15:30 UTC
As suspected, the error goes away from the image I downloaded.  Gimp still has a problem with the original.  
Comment 8 Sven Neumann 2007-08-13 07:18:07 UTC
Have you tried to update libexif as you have been told in comment #3?
Comment 9 Raphaël Quinet 2007-08-13 12:57:22 UTC
Robert, if you have no other solution, you can just e-mail the image to me so that I can have a look and decide if this is the old libexif bug or not.  Don't use my gimp.org address, but instead send it to raphael(dot)quinet(at)gmail(dot)com.
Comment 10 Robert F. Chapman 2007-08-14 03:11:13 UTC
Raphael,  I sent the image and you should have access to it soon.  

Sven,  I'm currently running libexif-0.6.15-2.fc7.  Is there a newer version that I don't know about?

Thanks,


Robert
Comment 11 Raphaël Quinet 2007-08-14 08:58:32 UTC
Alas, I can confirm this bug even when using the latest version of libexif (version 0.6.16).  I can also confirm that it is a new bug, different from bug #358117 and its many duplicates.  Like several of the previous bugs, this one may also be related to the way libexif parses the Olympus MakerNotes.

I am currently investigating this in order to confirm that it is a bug in libexif and not in the way we pass data to it, but it is already clear that the insane amounts of memory are allocated from within libexif.  Here is the stack trace that I got when I interrupted the plug-in (at that point, my machine was almost unusable):

  • #0 memcpy
    from /lib/libc.so.6
  • #1 exif_data_new_from_file
    from /usr/lib/libexif.so.12
  • #2 exif_data_new_from_file
    from /usr/lib/libexif.so.12
  • #3 exif_data_save_data
    from /usr/lib/libexif.so.12
  • #4 gimp_metadata_store_exif
    at gimpexif.c line 58
  • #5 load_image
    at jpeg-load.c line 320

In case anyone wants to analyze that image, I have stored it temporarily at:
  http://wilber.gimp.org/~raphael/P4060241.JPG
But I will not keep it there for a long time because the disk is almost full.
Comment 12 Raphaël Quinet 2007-08-14 12:45:16 UTC
A deeper analysis shows that it is definitely a new bug in libexif.  It affects all GIMP versions that link with libexif.

This bug occurs in the part of libexif that rewrites the Olympus MakerNote.  Other programs such as eog (Eye Of Gnome) may not be affected because they do not use the parts of libexif that modify the EXIF block like GIMP does.

I traced the way libexif allocates and reallocates memory and I saw that it reallocates a block of memory with small increments until it does this:
  realloc 0x80a0b58 to size 588
  realloc 0x80a0b58 to size 608
  realloc 0x80a0b58 to size 616
  realloc 0x80a0b58 to size 624
  realloc 0x80a0b58 to size 632
  realloc 0x80a0dd8 to size 736494126    <-- oops!
  realloc 0x80a0b58 to size 736494758
This is what kills the system because it reallocates these 700 MB multiple times with increasing sizes, causing huge amounts of data to be copied back and forth in memory.

I then added some code to abort the program at the first attempt to allocate insane amounts of memory and I got this stack trace:
  • #0 raise
    from /lib/libc.so.6
  • #1 abort
    from /lib/libc.so.6
  • #2 exif_mem_realloc_func
    at exif-mem.c line 25
  • #3 exif_mem_realloc
    at exif-mem.c line 94
  • #4 exif_mnote_data_olympus_save
    at exif-mnote-data-olympus.c line 176
  • #5 exif_mnote_data_save
    at exif-mnote-data.c line 92
  • #6 exif_data_save_data_content
    at exif-data.c line 245
  • #7 exif_data_save_data_content
    at exif-data.c line 551
  • #8 exif_data_save_data
    at exif-data.c line 928
  • #9 gimp_metadata_store_exif
    at gimpexif.c line 58

In exif_mnote_data_olympus_save() (frame #4), the variable "s" that defines the size increment for the buffer gets the ridiculous value 736481084 when i=862.

I have submitted this bug to the libexif maintainers:
https://sourceforge.net/tracker/index.php?func=detail&aid=1773810&group_id=12272&atid=112272

This GIMP bug report will remain open until the bug is fixed in libexif.
Comment 13 Robert F. Chapman 2007-08-14 14:42:38 UTC
This also happens to several programs that must also use libexif, gthumb (when saving the image).  BTW, this is not only a problem with Olympus images, this also occurs with my Cannon images as well.
Comment 14 Raphaël Quinet 2007-08-14 19:29:59 UTC
If this also happens with Canon images, then please send me a file that triggers this bug (same e-mail address as before).  This bug is specific to the Olympus MakerNote, so the crash is probably different with files from a Canon camera.

Do these images come straight out of the memory card of the camera, or did you use some program (third-party or supplied with the camera) to download them?  Did you use any other program to manipulate these files?
Comment 15 Robert F. Chapman 2007-08-15 00:32:19 UTC
I'm sorry, the other images in question were created with my Olympus as well.  These images were all pulled off of the memory card.  No third-party applications were used to manipulate these images.
Comment 16 Jan Patera 2007-08-16 19:30:56 UTC
Robert, what Olympus model do you have? Could you please send me a sample
image to patera at users.sourceforge.net? Thank you. This bug occurs only when the
central IFD is in Big Endian order (I have seen just one file like this)
and makernote is also in Big Endian (I have never seen such a file...).

(In reply to comment #15)
> I'm sorry, the other images in question were created with my Olympus as well. 
> These images were all pulled off of the memory card.  No third-party
> applications were used to manipulate these images.

Comment 17 Robert F. Chapman 2007-08-17 03:27:50 UTC
Jan,  I sent the image to you,  just so other have the info I sent you.

I have an Olympus E-20, here is some of the image information about the camera

Image Type: jpeg (The JPEG image format)
Width: 2560 pixels
Height: 1920 pixels
Camera Brand: OLYMPUS OPTICAL CO.,LTD
Camera Model: E-20,E-20N,E-20P
Date Taken: 2002:04:06 05:02:39
Exposure Time: 1/159 sec.
Exposure Program: Normal program
Metering Mode: Pattern
Flash Fired: Flash did not fire.
Focal Length: 17.0 mm
ISO Speed Rating: 80
Software: 29-1102                        

Let me know if you have any questions.

Thanks,

Robert Chapman
Comment 18 Jan Patera 2007-08-17 08:01:58 UTC
Robert, unfortunately I didn't get any email from you and I have no idea what
your email address is therefore I have to use this public forum.
Anyway, I was able to get some images taken by the same camera from
a different source and I was able to reproduce the bug with libexif 0.6.16.
(In reply to comment #17)
> Jan,  I sent the image to you,  just so other have the info I sent you.
Comment 19 Jan Patera 2007-08-17 08:07:32 UTC
This bug was probably introduced in libexif 0.6.16 when fixing libexif bug No. 1525770. In that bug, there was a file with big endian main Exif IFD but with little endian makernote. Now from 2 sources I see that there also exist images (taken by Olympus E20) that have both main IFD and makernote IFD in big endian order. Majority of Olympus files is in little endian entirely. 
The fix for 1525770 did not work correctly with E20 images.
I added a really heuristical fix to detect this new case. In libexif CVS since yesterday. Same bug as libexif bug No. 1774626 and 1773810:
http://sourceforge.net/tracker/index.php?func=detail&aid=1773810&group_id=12272&atid=112272
http://sourceforge.net/tracker/index.php?func=detail&aid=1774626&group_id=12272&atid=112272
Comment 20 Raphaël Quinet 2007-08-17 11:03:54 UTC
I just tried building libexif from CVS and indeed it seems to fix the problem.  Thanks for the quick patch, Jan!  We should close this bug report as soon as a new official release of libexif is out.  I hope that it will happen before GIMP 2.4 is out, so that we can still bump the required version number in our 'configure' tests.
Comment 21 Robert F. Chapman 2007-08-18 07:35:37 UTC
Yes, I as well patched the fedora source rpm from the CVS and the new build worked fine.  This also fixed an issue with another olympus image I had, where it would segfault the gnome plugin while loading.  

Thanks Jan, 


Robert
Comment 22 Jim Gribbin 2007-08-29 05:02:13 UTC
I seem to be getting this exact same thing with images from my Canon D30.

Using Gimp 2.2.17 on Windows 2000 Pro.

As soon as I attempt opening a .jpg file uploaded from my camera, I get a message about plugin: jpeg.exe crashing.

I have a copy of Gimp 2.2.12 around and tried installing it to see what kind of difference it made. With .12, Gimp crashes with "Unknown file type" if I tell Canon's Zoom Browser to open the selected image for editing with an external application choosing Gimp. However, if I already have Gimp up and running, I seem to be able to open the same file satisfactorily.
Comment 23 Michael Schumacher 2007-08-29 08:01:37 UTC
The exact same thing, including the endianess in the Makernote?
Comment 24 Jan Patera 2007-08-29 08:41:38 UTC
No. This bug is about Olympus makernotes, this Jim's case is about Canon D30 (note: not 30D) - it is different code. Jim has sent me his image and it is entirely in little endian. 
I do not have gimp. But I am not able to reproduce any problem (testing on Windows) with several libexif versions.
I'll follow up with Jim directly and post resume here.

> The exact same thing, including the endianess in the Makernote?

Comment 25 Raphaël Quinet 2007-08-29 11:19:41 UTC
Jim, you are probably affected by an older problem, such as bug #358117 or some of its duplicates.  GIMP 2.2.12 is more than one year old and was linked with an even older version of libexif.  I recommend that you upgrade to GIMP 2.2.17 now, or GIMP 2.4 as soon as it is released.  You can also send me the image that causes problems and I will check if the current GIMP can load it or not (see comment #9 for the e-mail address to use).

Let's keep this bug report focused on the Olympus MakerNote only.
Comment 26 Raphaël Quinet 2007-08-29 11:22:42 UTC
Err... forget the part of my comment about upgrading to 2.2.17, since you already have that.  But you should still upgrade to 2.4 as soon as it is released.
Comment 27 Michael Schumacher 2007-09-06 11:07:02 UTC
*** Bug 474024 has been marked as a duplicate of this bug. ***
Comment 28 Sven Neumann 2007-09-11 09:43:50 UTC
Still no libexif release with this fix...
Comment 29 Raphaël Quinet 2007-09-11 10:57:16 UTC
I know...  I'm having a look on the libexif page every few days, hoping that Jan would make a new official release...
Comment 30 Jan Patera 2007-09-11 12:23:54 UTC
I am not doing any releases - I don't have the knowledge needed...
That's other guys who make them.
Anyway, I asked Raphael (via private mail) few weeks ago when is next GIMP due to know how much time we have. Still waiting for any date...
So, how urgent is it?
Comment 31 Michael Schumacher 2007-09-11 13:05:26 UTC
Hm... given comments #28 and #29, I'd say that it's rather like we're waiting for a new libexif release :)
Comment 32 Sven Neumann 2007-10-14 17:51:33 UTC
*** Bug 486620 has been marked as a duplicate of this bug. ***
Comment 33 Manish Singh 2007-10-14 20:46:49 UTC
*** Bug 486620 has been marked as a duplicate of this bug. ***
Comment 34 Manish Singh 2007-11-12 09:05:12 UTC
*** Bug 496067 has been marked as a duplicate of this bug. ***
Comment 35 Sven Neumann 2008-05-05 14:40:21 UTC
This is ridiculous. Even though the problem has been fixed in libexif about nine months ago, there is still no libexif release that contains this fix. I just checked and the version that is in debian unstable is still affected by this bug. libexif 0.6.16 still seems to be the latest upstream release.
Comment 36 Robert F. Chapman 2008-05-05 18:20:22 UTC
I tried several months ago to have the libexif patch added into the fedora release (8) and it didn't make it in.  I havn't checked, but I think fedora 9 will still have the same issue.  I issued a redhat  bug that pointed to this error, but I have had no feedback as to the progress of updating libexif in fedora 9

I'm currently running fedora 7 and 8, I had to patch my systems and since then have not had any issues with Olympus images in libexif.    
Comment 37 Sven Neumann 2008-05-15 20:26:10 UTC
*** Bug 531564 has been marked as a duplicate of this bug. ***
Comment 38 Sven Neumann 2008-10-08 22:58:51 UTC
*** Bug 555616 has been marked as a duplicate of this bug. ***
Comment 39 Michael Schumacher 2008-11-11 20:45:44 UTC
libexif 0.6.17 has finally been released. When we are approaching the next release, we should start to depend on it.
Comment 40 Sven Neumann 2008-11-11 20:54:00 UTC
Closing as NOTGNOME then.