[gimp] Bug 794949 - Plugin crash when opening png, jpeg or tiff with...



commit ba06a0fe86088b37cef3eeb3db1ce5bb39f2257c
Author: Jehan <jehan girinstud io>
Date:   Thu Apr 5 00:12:00 2018 +0200

    Bug 794949 - Plugin crash when opening png, jpeg or tiff with...
    
    ... non-latin unicode path.
    g_win32_locale_filename_from_utf8() was sometimes returning NULL for
    some paths on Windows. Then the call to gexiv2_metadata_open_path() with
    a NULL value was crashing plug-ins.
    This commit only prevents from crashing by simply failing to load
    metadata when this occurs, which means losing metadata support on
    Windows depending on filenames. A proper solution will have to be
    implemented.

 libgimpbase/gimpmetadata.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/libgimpbase/gimpmetadata.c b/libgimpbase/gimpmetadata.c
index 2c9e43d..15c346c 100644
--- a/libgimpbase/gimpmetadata.c
+++ b/libgimpbase/gimpmetadata.c
@@ -848,6 +848,17 @@ gimp_metadata_load_from_file (GFile   *file,
 
 #ifdef G_OS_WIN32
   filename = g_win32_locale_filename_from_utf8 (path);
+  /* FIXME!
+   * This call can return NULL, which later crashes the call to
+   * gexiv2_metadata_open_path().
+   * See bug 794949.
+   */
+  if (! filename)
+    {
+      g_set_error (error, GIMP_METADATA_ERROR, 0,
+                   _("Conversion of the filename to system codepage failed."));
+      return NULL;
+    }
 #else
   filename = g_strdup (path);
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]