From 518f7071a7f3073a4eeae56e3c585f66968e159d Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Fri, 16 Apr 2010 09:44:35 -0400 Subject: [gsettings] G_VARIANT_TYPE_HANDLE is a signed 32bit integer --- gsettings/gconfsettingsbackend.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'gsettings/gconfsettingsbackend.c') diff --git a/gsettings/gconfsettingsbackend.c b/gsettings/gconfsettingsbackend.c index c8359249..e76a3a37 100644 --- a/gsettings/gconfsettingsbackend.c +++ b/gsettings/gconfsettingsbackend.c @@ -338,7 +338,12 @@ gconf_settings_backend_simple_gconf_value_type_to_gvariant (GConfValue * variant = g_variant_new_uint64 (value); } else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_HANDLE)) - variant = g_variant_new_handle (gconf_value_get_int (gconf_value)); + { + int value = gconf_value_get_int (gconf_value); + if (value < 0) + return NULL; + variant = g_variant_new_handle (value); + } else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_DOUBLE)) variant = g_variant_new_double (gconf_value_get_float (gconf_value)); else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_STRING)) @@ -519,7 +524,9 @@ gconf_settings_backend_simple_gvariant_to_gconf_value (GVariant *value } else if (g_variant_type_equal (type, G_VARIANT_TYPE_HANDLE)) { - gint32 i = g_variant_get_handle (value); + guint32 i = g_variant_get_handle (value); + if (i > G_MAXINT) + return NULL; gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, i); } -- cgit v1.2.1