From 062cfaa7c7dfad23382488e128d0c618118e1aca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Str=C3=A1nsk=C3=BD?= Date: Fri, 27 Nov 2009 13:20:27 +1300 Subject: [PATCH] b=495392 protect against bogus GdkAtoms from gtk_selection_data_get_targets() r=karlt --- widget/src/gtk2/nsClipboard.cpp | 3 +++ widget/src/gtk2/nsDragService.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/widget/src/gtk2/nsClipboard.cpp b/widget/src/gtk2/nsClipboard.cpp index 963fb345a5f..c7368faa337 100644 --- a/widget/src/gtk2/nsClipboard.cpp +++ b/widget/src/gtk2/nsClipboard.cpp @@ -452,6 +452,9 @@ nsClipboard::HasDataMatchingFlavors(const char** aFlavorList, PRUint32 aLength, for (PRInt32 j = 0; j < n_targets; j++) { gchar *atom_name = gdk_atom_name(targets[j]); + if (!atom_name) + continue; + if (!strcmp(atom_name, aFlavorList[i])) *_retval = PR_TRUE; diff --git a/widget/src/gtk2/nsDragService.cpp b/widget/src/gtk2/nsDragService.cpp index ffdade5d51d..3845a3585bc 100644 --- a/widget/src/gtk2/nsDragService.cpp +++ b/widget/src/gtk2/nsDragService.cpp @@ -981,7 +981,7 @@ nsDragService::IsTargetContextList(void) GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data); gchar *name = NULL; name = gdk_atom_name(atom); - if (strcmp(name, gMimeListType) == 0) + if (name && strcmp(name, gMimeListType) == 0) retval = PR_TRUE; g_free(name); if (retval)