GNOME Bugzilla – Bug 766824
Invalid comment string causes export crash
Last modified: 2016-05-30 16:58:45 UTC
Created attachment 328409 [details] The file with invalid comment for testing. When trying to export the attached file, GIMP crashes when "Save Comment" option is checked on png export. Several in the gimp-developer email threads confirmed this is a problem with the comment data being invalid/corrupt. The proposed fix is that GIMP should do some error checking and resolve this issue by binning invalid data and posting a warning, then continuing the export as normal. -C
To be accurate: I have not confirmed because I have not tested or checked the file myself. But it was said that non-ASCII characters were used in the Exif's ImageDescription field. Yet according to the Exif spec (http://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf), this field is supposed to be ASCII only apparently (yes that's sucky, definitely). To use multi-byte encoding, the right field is UserComment. So this may well be the issue (once again, I did not test myself). Anyway it would be good if GIMP were more robust to otherwise-valid images, even with buggy metadata. In particular, it should not fail to export, but simply discard the wrong metadata field with a warning.
Someone notes on the ML: > To make matters worse, the MWG guidelines [0] state that "Exif tags documented in the Exif specification as type ASCII SHOULD be written as UTF-8". > [0] http://metadataworkinggroup.org/pdf/mwg_guidance.pdf
I finally tried to open then export your image as PNG. No error, it just works. In the shell, it indeed outputs some kind of error about wrong metadata contents, but telling it actually does some sensible bypassing: base64-ing the broken data and keeping it in the metadata field (this way it does not fully discard it but in the same time, the metadata is not broken anymore): > Invalid UTF-8 in metadata value Exif.Image.ImageDescription, encoding as base64: Egk6XHf8AA== > Invalid UTF-8 in metadata value Exif.Photo.UserComment, encoding as base64: Egk6XHf8AA== It does not even come from a recent commit (33a8d681, from 2013) so that's weird. On the ML, you say that you actually use the ppa version. Could you try with the actual git repository and tell us if the problem still happens?
I would say this fixes it, the comment from the attached image is rejected by the new validation code, and re-exporting to PNG works fine: commit cf3b6903c012c74b787de6eeaa1670adb63ecba2 Author: Michael Natterer <mitch@gimp.org> Date: Mon May 30 18:56:29 2016 +0200 Bug 766824 - Invalid comment string causes export crash UTF-8 validate the "gimp-comment" parasite and reject it on failure. app/core/gimpimage.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)