When exiting gimp, I see this:

** (file-jpeg:8307): WARNING **: JPEG - unable to decode XMP metadata packet
gimp: terminated: Abort trap

gimp: vfprintf NULL    <resource identifier="%s" checksum="%s">

I also managed to hit the same problem in the open dialog.

This is in app/core/gimptagcache.c

406       g_string_append_printf (buf, "\n  <resource identifier=\"%s\" 
checksum=\"%s\">\n",
407                               identifier_string,
408                               g_quark_to_string (cache_rec->checksum));

and the problem is that glib2's g_quark_to_string(0) returns NULL.

The patch below fixes that one, one more of the same kind, plus an
explicit fallback to NULL. The formatting "(NULL)" is consistent with
similar fallbacks in the same file (e.g. line 293).

In the same file there are a few more %s format specifiers that could
potentially be problematic (even more if we start worrying about malloc
failures), but for now I preferred to go for the minimal fix.

Index: Makefile
===================================================================
RCS file: /var/cvs/ports/graphics/gimp/stable/Makefile,v
retrieving revision 1.108
diff -u -p -r1.108 Makefile
--- Makefile    2 Aug 2016 08:17:20 -0000       1.108
+++ Makefile    9 Aug 2016 01:24:34 -0000
@@ -3,6 +3,7 @@
 COMMENT=       GNU Image Manipulation Program
 
 DISTNAME=      gimp-2.8.18
+REVISION=      0
 
 SHARED_LIBS+=  gimp-2.0        272.0   # 800.0
 SHARED_LIBS+=  gimpbase-2.0    272.0   # 800.0
Index: patches/patch-app_core_gimptagcache_c
===================================================================
RCS file: patches/patch-app_core_gimptagcache_c
diff -N patches/patch-app_core_gimptagcache_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-app_core_gimptagcache_c       9 Aug 2016 01:58:32 -0000
@@ -0,0 +1,32 @@
+$OpenBSD$
+--- app/core/gimptagcache.c.orig       Fri Aug 21 00:57:25 2015
++++ app/core/gimptagcache.c    Tue Aug  9 03:58:01 2016
+@@ -404,8 +404,8 @@ gimp_tag_cache_save (GimpTagCache *cache)
+ 
+       identifier_string = g_markup_escape_text (g_quark_to_string 
(cache_rec->identifier), -1);
+       g_string_append_printf (buf, "\n  <resource identifier=\"%s\" 
checksum=\"%s\">\n",
+-                              identifier_string,
+-                              g_quark_to_string (cache_rec->checksum));
++                              identifier_string ? identifier_string : 
"(NULL)",
++                              cache_rec->checksum ? g_quark_to_string 
(cache_rec->checksum) : "(NULL)");
+       g_free (identifier_string);
+ 
+       for (tag_iterator = cache_rec->tags;
+@@ -494,7 +494,7 @@ gimp_tag_cache_load (GimpTagCache *cache)
+   else
+     {
+       g_printerr ("Failed to parse tag cache: %s\n",
+-                  error ? error->message : NULL);
++                  error ? error->message : "(NULL)");
+     }
+ 
+   g_free (filename);
+@@ -591,7 +591,7 @@ gimp_tag_cache_load_text (GMarkupParseContext  *contex
+       else
+         {
+           g_warning ("dropping invalid tag '%s' from '%s'\n", buffer,
+-                     g_quark_to_string 
(parse_data->current_record.identifier));
++                     parse_data->current_record.identifier ? 
g_quark_to_string (parse_data->current_record.identifier) : "(NULL)");
+         }
+     }
+ }

Reply via email to