From 2d3a68a47c20a7b375b2ffd4baac34089b9badd6 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sat, 2 Apr 2011 21:30:53 +0200 Subject: [PATCH 1/2] In completion_match_func(), don't crash if chooser_entry->file_part can't be g_utf8_normalize()'d --- gtk/gtkfilechooserentry.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index e539a8a..a934952 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -407,6 +407,11 @@ completion_match_func (GtkEntryCompletion *comp, } norm_file_part = g_utf8_normalize (chooser_entry->file_part, -1, G_NORMALIZE_ALL); + if (NULL == norm_file_part) + { + g_free (name); + return FALSE; + } norm_name = g_utf8_normalize (name, -1, G_NORMALIZE_ALL); #ifdef G_PLATFORM_WIN32 -- 1.7.4.1 From e1c628d9bdd4550dd0bf27c881767cebf14722b3 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sat, 2 Apr 2011 21:31:21 +0200 Subject: [PATCH 2/2] In completion_match_func(), complain if chooser_entry->file_part can't be g_utf8_normalize()'d --- gtk/gtkfilechooserentry.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index a934952..07f747b 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -409,6 +409,8 @@ completion_match_func (GtkEntryCompletion *comp, norm_file_part = g_utf8_normalize (chooser_entry->file_part, -1, G_NORMALIZE_ALL); if (NULL == norm_file_part) { + g_warning ("completion_match_func(): normalizing '%s' failed. Invalid encoding?", + chooser_entry->file_part); g_free (name); return FALSE; } -- 1.7.4.1