mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-26 14:28:15 -05:00
289f7a47de
* gnu/packages/patches/gtk2-harden-list-store.patch: New file. * gnu/packages/gtk.scm (gtk+-2)[patches]: Add it here. * gnu/local.mk (dist_patch_DATA): Register it here.
42 lines
1.3 KiB
Diff
42 lines
1.3 KiB
Diff
Backport the implementation of gtk_list_store_iter_is_valid from gtk+-3.
|
|
|
|
Index: gtk+-2.24.33/gtk/gtkliststore.c
|
|
===================================================================
|
|
--- gtk+-2.24.33.orig/gtk/gtkliststore.c
|
|
+++ gtk+-2.24.33/gtk/gtkliststore.c
|
|
@@ -1195,16 +1195,31 @@ gboolean
|
|
gtk_list_store_iter_is_valid (GtkListStore *list_store,
|
|
GtkTreeIter *iter)
|
|
{
|
|
+ GSequenceIter *seq_iter;
|
|
+
|
|
g_return_val_if_fail (GTK_IS_LIST_STORE (list_store), FALSE);
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
|
|
|
- if (!VALID_ITER (iter, list_store))
|
|
- return FALSE;
|
|
+ /* can't use VALID_ITER() here, because iter might point
|
|
+ * to random memory.
|
|
+ *
|
|
+ * We MUST NOT dereference it.
|
|
+ */
|
|
|
|
- if (g_sequence_iter_get_sequence (iter->user_data) != list_store->seq)
|
|
+ if (iter == NULL ||
|
|
+ iter->user_data == NULL ||
|
|
+ list_store->stamp != iter->stamp)
|
|
return FALSE;
|
|
|
|
- return TRUE;
|
|
+ for (seq_iter = g_sequence_get_begin_iter (list_store->seq);
|
|
+ !g_sequence_iter_is_end (seq_iter);
|
|
+ seq_iter = g_sequence_iter_next (seq_iter))
|
|
+ {
|
|
+ if (seq_iter == iter->user_data)
|
|
+ return TRUE;
|
|
+ }
|
|
+
|
|
+ return FALSE;
|
|
}
|
|
|
|
static gboolean real_gtk_list_store_row_draggable (GtkTreeDragSource *drag_source,
|