[glib/glib-2-64: 1/5] gcontenttype: Fix crash in _get_generic_icon_name()



commit 0869713daefd4f5961a01a8c77e9a2e1db06c7ea
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Feb 28 15:09:50 2020 +0100

    gcontenttype: Fix crash in _get_generic_icon_name()
    
    Guard against NULL type being passed to
    g_content_type_get_generic_icon_name() just as we protect
    g_content_type_get_description(), otherwise it will cause a crash.
    
    See https://gitlab.gnome.org/GNOME/gtk/issues/2482

 gio/gcontenttype.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gio/gcontenttype.c b/gio/gcontenttype.c
index 04d278db3..2716c8981 100644
--- a/gio/gcontenttype.c
+++ b/gio/gcontenttype.c
@@ -614,6 +614,8 @@ g_content_type_get_generic_icon_name (const gchar *type)
   const gchar *xdg_icon_name;
   gchar *icon_name;
 
+  g_return_val_if_fail (type != NULL, NULL);
+
   G_LOCK (gio_xdgmime);
   xdg_icon_name = xdg_mime_get_generic_icon (type);
   G_UNLOCK (gio_xdgmime);


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