unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob b107ba2bcc2ff0274ecb329f7c6c9749136c4da9 1254 bytes (raw)
name: gnu/packages/patches/gtk2-harden-list-store.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 
Mimic the implemenetation in 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,

debug log:

solving b107ba2bcc ...
found b107ba2bcc in https://yhetil.org/guix-patches/09b3598cb0fb0acd211dd59fc10686188b941d8e.camel@gmail.com/

applying [1/1] https://yhetil.org/guix-patches/09b3598cb0fb0acd211dd59fc10686188b941d8e.camel@gmail.com/
diff --git a/gnu/packages/patches/gtk2-harden-list-store.patch b/gnu/packages/patches/gtk2-harden-list-store.patch
new file mode 100644
index 0000000000..b107ba2bcc

1:21: trailing whitespace.
 
1:29: trailing whitespace.
 
1:35: trailing whitespace.
 
1:47: trailing whitespace.
 
Checking patch gnu/packages/patches/gtk2-harden-list-store.patch...
Applied patch gnu/packages/patches/gtk2-harden-list-store.patch cleanly.
warning: 4 lines add whitespace errors.

index at:
100644 b107ba2bcc2ff0274ecb329f7c6c9749136c4da9	gnu/packages/patches/gtk2-harden-list-store.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).