gtk3/gtk3-prevent-g_file_get_basename-return-NULL.patch
Dominique Leuenberger 928616ecdb Accepting request 887390 from home:qkzhu:branches:GNOME:Factory
- Add gtk3-prevent-g_file_get_basename-return-NULL.patch:
  + Fix a possible crash in gtk_show_uri
    (boo#1185082, glgo#GNOME/gtk!3458).

OBS-URL: https://build.opensuse.org/request/show/887390
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk3?expand=0&rev=397
2021-04-22 06:14:25 +00:00

26 lines
737 B
Diff

commit ce2a433ca157b444b54646aa0383ff5b75cc41f9
Author: Matthias Clasen <mclasen@redhat.com>
Date: Mon Apr 19 16:39:53 2021 -0400
Fix a possible crash in gtk_show_uri
g_file_get_basename can return NULL.
Deal with it somehow.
Fixes: #3883
diff --git a/gdk/x11/gdkapplaunchcontext-x11.c b/gdk/x11/gdkapplaunchcontext-x11.c
index 206c34e52d..43c190e5e6 100644
--- a/gdk/x11/gdkapplaunchcontext-x11.c
+++ b/gdk/x11/gdkapplaunchcontext-x11.c
@@ -45,6 +45,9 @@ get_display_name (GFile *file,
if (name == NULL)
{
name = g_file_get_basename (file);
+ if (name == NULL)
+ name = g_file_get_uri (file);
+
if (!g_utf8_validate (name, -1, NULL))
{
tmp = name;