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



commit 169c134c58f879be17984c25bdb8d06ce42ca1d6
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 d2a211a..ff266c1 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -603,6 +603,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,
@@ -656,6 +660,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]