[gnome-control-center] wacom: check for the action type value



commit f5e8101dbdac3d4287119e57c1219da74cfab216
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Thu Nov 29 11:58:18 2012 +0100

    wacom: check for the action type value
    
    Action type comes from GSettings and may have been changed
    to some invalid value, causing a segmentation fault in
    control-center if the value is larger than the known action
    types. This can also occur when downgrading from a version
    with more possible actions.
    
    Adds a sanity check to verify the given action type value
    is within the bounds of the known action types.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=689265

 panels/wacom/cc-wacom-page.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index acd0509..5c91c39 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -613,6 +613,10 @@ add_button_to_store (GtkListStore         *model,
 		dir_name = NULL;
 	}
 
+	/* Sanity check */
+	if (type >= G_N_ELEMENTS(action_table))
+		type = GSD_WACOM_ACTION_TYPE_NONE;
+
 	gtk_list_store_append (model, &new_row);
 	gtk_list_store_set (model, &new_row,
 			    MAPPING_DESCRIPTION_COLUMN, dir_name ? dir_name : button->name,
@@ -667,6 +671,10 @@ action_set_func (GtkTreeViewColumn *tree_column,
 	}
 
 	type = g_settings_get_enum (button->settings, ACTION_TYPE_KEY);
+	/* Sanity check */
+	if (type >= G_N_ELEMENTS(action_table))
+		type = GSD_WACOM_ACTION_TYPE_NONE;
+
 	g_object_set (cell,
 		      "visible", TRUE,
 		      "editable", TRUE,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]