[gtk/gtk-4-6] x11: Check return of gdk_x11_get_xatom_name_for_display



commit 66117d1017e082c2d81008f8103e44c44c2d3356
Author: Dr. David Alan Gilbert <dave treblig org>
Date:   Thu Mar 31 15:56:09 2022 +0100

    x11: Check return of gdk_x11_get_xatom_name_for_display
    
    When given an invalid atom, gdk_x11_get_xatom_name_for_display can
    return NULL and trigger a seg in gdk_x11_clipboard_formats_from_atoms.
    Check for NULL.
    
    Why I'm seeing a bad atom there is probably a separate question.
    https://bugzilla.redhat.com/show_bug.cgi?id=2037786

 gdk/x11/gdkclipboard-x11.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gdk/x11/gdkclipboard-x11.c b/gdk/x11/gdkclipboard-x11.c
index 4335674102..db2815ed52 100644
--- a/gdk/x11/gdkclipboard-x11.c
+++ b/gdk/x11/gdkclipboard-x11.c
@@ -248,6 +248,10 @@ gdk_x11_clipboard_formats_from_atoms (GdkDisplay *display,
       const char *name;
 
       name = gdk_x11_get_xatom_name_for_display (display , atoms[i]);
+      if (!name)
+        {
+          continue;
+        }
       if (strchr (name, '/'))
         {
           gdk_content_formats_builder_add_mime_type (builder, name);


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