[gtk: 1/2] x11: Check return of gdk_x11_get_xatom_name_for_display
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] x11: Check return of gdk_x11_get_xatom_name_for_display
- Date: Fri, 1 Apr 2022 00:56:35 +0000 (UTC)
commit 506566b6a4c3a9103b4c46db249d81edb8b87665
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]