diff options
author | Matthias Clasen <mclasen@redhat.com> | 2008-05-25 20:28:54 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2008-05-25 20:28:54 +0000 |
commit | 2bf2b07c1367e236c8cef30d2d074efef305d2b8 (patch) | |
tree | 4485c6d2d350f7a6df974b65879dfd49c17a95e2 /gtk/gtkliststore.c | |
parent | bd4acfe467cf84ce5d674e2a15bba7feb2633026 (diff) | |
download | gdk-pixbuf-2bf2b07c1367e236c8cef30d2d074efef305d2b8.tar.gz |
Bug 534694 – Col id in GtkListStore could be out of range
2008-05-25 Matthias Clasen <mclasen@redhat.com>
Bug 534694 – Col id in GtkListStore could be out of range
* gtk/gtkliststore.c (list_store_start_element): Fix up error handling
a bit. Pointed out by Jan Arne Petersen.
svn path=/trunk/; revision=20157
Diffstat (limited to 'gtk/gtkliststore.c')
-rw-r--r-- | gtk/gtkliststore.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/gtk/gtkliststore.c b/gtk/gtkliststore.c index b1e3ba5ee..f71836e1c 100644 --- a/gtk/gtkliststore.c +++ b/gtk/gtkliststore.c @@ -2084,8 +2084,11 @@ list_store_start_element (GMarkupParseContext *context, ColInfo *info; if (data->row_column >= data->n_columns) - g_set_error (error, data->error_quark, 0, - "Too many columns, maximum is %d\n", data->n_columns - 1); + { + g_set_error (error, data->error_quark, 0, + "Too many columns, maximum is %d\n", data->n_columns - 1); + return; + } for (i = 0; names[i]; i++) if (strcmp (names[i], "id") == 0) @@ -2093,9 +2096,18 @@ list_store_start_element (GMarkupParseContext *context, errno = 0; id = atoi (values[i]); if (errno) - g_set_error (error, data->error_quark, 0, - "the id tag %s could not be converted to an integer", - values[i]); + { + g_set_error (error, data->error_quark, 0, + "the id tag %s could not be converted to an integer", + values[i]); + return; + } + if (id < 0 || id >= data->n_columns) + { + g_set_error (error, data->error_quark, 0, + "id value %d out of range", id); + return; + } } else if (strcmp (names[i], "translatable") == 0) { @@ -2113,8 +2125,11 @@ list_store_start_element (GMarkupParseContext *context, } if (id == -1) - g_set_error (error, data->error_quark, 0, - "<col> needs an id attribute"); + { + g_set_error (error, data->error_quark, 0, + "<col> needs an id attribute"); + return; + } info = g_slice_new0 (ColInfo); info->translatable = translatable; |