[gconf] [gsettings] G_VARIANT_TYPE_HANDLE is a signed 32bit integer
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gconf] [gsettings] G_VARIANT_TYPE_HANDLE is a signed 32bit integer
- Date: Fri, 16 Apr 2010 13:45:21 +0000 (UTC)
commit 518f7071a7f3073a4eeae56e3c585f66968e159d
Author: Vincent Untz <vuntz gnome org>
Date: Fri Apr 16 09:44:35 2010 -0400
[gsettings] G_VARIANT_TYPE_HANDLE is a signed 32bit integer
gsettings/gconfsettingsbackend.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gsettings/gconfsettingsbackend.c b/gsettings/gconfsettingsbackend.c
index c835924..e76a3a3 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]