From 3ea41a9212435b879708d8fd42bef0f9be01ce7c Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 17 Dec 2003 22:47:55 +0000 Subject: [PATCH] Check that index is not bigger than level array length also when depth is 2003-12-17 Marco Pesenti Gritti * gtk/gtktreemodelsort.c: (gtk_tree_model_sort_get_iter): Check that index is not bigger than level array length also when depth is 1. Now get_iter_first correctly return FALSE when the model is empty (#129411). --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ ChangeLog.pre-2-4 | 8 ++++++++ ChangeLog.pre-2-6 | 8 ++++++++ ChangeLog.pre-2-8 | 8 ++++++++ gtk/gtktreemodelsort.c | 8 ++++++-- 6 files changed, 46 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index eb21e70c26..c379ace58c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-12-17 Marco Pesenti Gritti + + * gtk/gtktreemodelsort.c: (gtk_tree_model_sort_get_iter): + + Check that index is not bigger than level array length + also when depth is 1. Now get_iter_first correctly return + FALSE when the model is empty (#129411). + Wed Dec 17 23:31:19 2003 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_search_equal_func): only diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index eb21e70c26..c379ace58c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2003-12-17 Marco Pesenti Gritti + + * gtk/gtktreemodelsort.c: (gtk_tree_model_sort_get_iter): + + Check that index is not bigger than level array length + also when depth is 1. Now get_iter_first correctly return + FALSE when the model is empty (#129411). + Wed Dec 17 23:31:19 2003 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_search_equal_func): only diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index eb21e70c26..c379ace58c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +2003-12-17 Marco Pesenti Gritti + + * gtk/gtktreemodelsort.c: (gtk_tree_model_sort_get_iter): + + Check that index is not bigger than level array length + also when depth is 1. Now get_iter_first correctly return + FALSE when the model is empty (#129411). + Wed Dec 17 23:31:19 2003 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_search_equal_func): only diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index eb21e70c26..c379ace58c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +2003-12-17 Marco Pesenti Gritti + + * gtk/gtktreemodelsort.c: (gtk_tree_model_sort_get_iter): + + Check that index is not bigger than level array length + also when depth is 1. Now get_iter_first correctly return + FALSE when the model is empty (#129411). + Wed Dec 17 23:31:19 2003 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_search_equal_func): only diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index eb21e70c26..c379ace58c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +2003-12-17 Marco Pesenti Gritti + + * gtk/gtktreemodelsort.c: (gtk_tree_model_sort_get_iter): + + Check that index is not bigger than level array length + also when depth is 1. Now get_iter_first correctly return + FALSE when the model is empty (#129411). + Wed Dec 17 23:31:19 2003 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_search_equal_func): only diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c index eacb3d5c0a..ab393219c3 100644 --- a/gtk/gtktreemodelsort.c +++ b/gtk/gtktreemodelsort.c @@ -970,8 +970,12 @@ gtk_tree_model_sort_get_iter (GtkTreeModel *tree_model, level = g_array_index (level->array, SortElt, indices[i]).children; } - if (level == NULL) - return FALSE; + if (!level || indices[i] >= level->array->len) + { + iter->stamp = 0; + return FALSE; + } + iter->stamp = tree_model_sort->stamp; iter->user_data = level; iter->user_data2 = &g_array_index (level->array, SortElt, indices[depth - 1]);