summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>2001-05-16 18:16:57 +0000
committerJonathan Blandford <jrb@src.gnome.org>2001-05-16 18:16:57 +0000
commit97fb7b787866125933df5a832f9869a1bde4bd17 (patch)
treee6ea058c6dcc273bdb9fa2db78ca2f35c9a4bd65
parent2970a2feeece3e2c93760099394f2587379ddb09 (diff)
downloadgdk-pixbuf-97fb7b787866125933df5a832f9869a1bde4bd17.tar.gz
fix bug #54699 where paths weren't being checked for correctness.
Wed May 16 14:06:01 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreemodel.c (gtk_tree_path_new_from_string): fix bug #54699 where paths weren't being checked for correctness.
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.pre-2-05
-rw-r--r--ChangeLog.pre-2-105
-rw-r--r--ChangeLog.pre-2-25
-rw-r--r--ChangeLog.pre-2-45
-rw-r--r--ChangeLog.pre-2-65
-rw-r--r--ChangeLog.pre-2-85
-rw-r--r--gtk/gtktreemodel.c31
8 files changed, 58 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index f85c19820..d97f0f09f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed May 16 14:06:01 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreemodel.c (gtk_tree_path_new_from_string): fix bug
+ #54699 where paths weren't being checked for correctness.
+
Tue May 15 20:13:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c: You can now set all sorts of properties
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index f85c19820..d97f0f09f 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,8 @@
+Wed May 16 14:06:01 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreemodel.c (gtk_tree_path_new_from_string): fix bug
+ #54699 where paths weren't being checked for correctness.
+
Tue May 15 20:13:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c: You can now set all sorts of properties
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index f85c19820..d97f0f09f 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,8 @@
+Wed May 16 14:06:01 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreemodel.c (gtk_tree_path_new_from_string): fix bug
+ #54699 where paths weren't being checked for correctness.
+
Tue May 15 20:13:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c: You can now set all sorts of properties
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index f85c19820..d97f0f09f 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,8 @@
+Wed May 16 14:06:01 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreemodel.c (gtk_tree_path_new_from_string): fix bug
+ #54699 where paths weren't being checked for correctness.
+
Tue May 15 20:13:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c: You can now set all sorts of properties
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index f85c19820..d97f0f09f 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,8 @@
+Wed May 16 14:06:01 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreemodel.c (gtk_tree_path_new_from_string): fix bug
+ #54699 where paths weren't being checked for correctness.
+
Tue May 15 20:13:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c: You can now set all sorts of properties
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index f85c19820..d97f0f09f 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,8 @@
+Wed May 16 14:06:01 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreemodel.c (gtk_tree_path_new_from_string): fix bug
+ #54699 where paths weren't being checked for correctness.
+
Tue May 15 20:13:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c: You can now set all sorts of properties
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index f85c19820..d97f0f09f 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,8 @@
+Wed May 16 14:06:01 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreemodel.c (gtk_tree_path_new_from_string): fix bug
+ #54699 where paths weren't being checked for correctness.
+
Tue May 15 20:13:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c: You can now set all sorts of properties
diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c
index c79e1fe90..db062631a 100644
--- a/gtk/gtktreemodel.c
+++ b/gtk/gtktreemodel.c
@@ -145,22 +145,24 @@ gtk_tree_path_new (void)
* gtk_tree_path_new_from_string:
* @path: The string representation of a path.
*
- * Creates a new #GtkTreePath initialized to @path. @path is expected
- * to be a colon separated list of numbers. For example, the string
- * "10:4:0" would create a path of depth 3 pointing to the 11th child
- * of the root node, the 5th child of that 11th child, and the 1st
- * child of that 5th child.
+ * Creates a new #GtkTreePath initialized to @path. @path is expected to be a
+ * colon separated list of numbers. For example, the string "10:4:0" would
+ * create a path of depth 3 pointing to the 11th child of the root node, the 5th
+ * child of that 11th child, and the 1st child of that 5th child. If an invalid
+ * path is past in, NULL is returned.
*
- * Return value: A newly created #GtkTreePath.
+ * Return value: A newly created #GtkTreePath, or NULL
**/
GtkTreePath *
gtk_tree_path_new_from_string (gchar *path)
{
GtkTreePath *retval;
+ gchar *orig_path = path;
gchar *ptr;
gint i;
- g_return_val_if_fail (path != NULL, gtk_tree_path_new ());
+ g_return_val_if_fail (path != NULL, NULL);
+ g_return_val_if_fail (*path != '\000', NULL);
retval = gtk_tree_path_new ();
@@ -169,9 +171,20 @@ gtk_tree_path_new_from_string (gchar *path)
i = strtol (path, &ptr, 10);
gtk_tree_path_append_index (retval, i);
+ if (i < 0)
+ {
+ g_warning (G_STRLOC"Negative numbers in path %s passed to gtk_tree_path_new_from_string", orig_path);
+ gtk_tree_path_free (retval);
+ return NULL;
+ }
if (*ptr == '\000')
break;
- /* FIXME: should we error out if this is not a ':', or should we be tolerant? */
+ if (ptr == path || *ptr != ':')
+ {
+ g_warning (G_STRLOC"Invalid path %s passed to gtk_tree_path_new_from_string", orig_path);
+ gtk_tree_path_free (retval);
+ return NULL;
+ }
path = ptr + 1;
}
@@ -193,6 +206,8 @@ gtk_tree_path_to_string (GtkTreePath *path)
gchar *retval, *ptr;
gint i;
+ g_return_val_if_fail (path != NULL, NULL);
+
if (path->depth == 0)
return NULL;