[gnome-python] Bug 595566: crash when passing a list with a None value to GConf
- From: Gustavo J. A. M. Carneiro <gjc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-python] Bug 595566: crash when passing a list with a None value to GConf
- Date: Sat, 28 Nov 2009 18:36:15 +0000 (UTC)
commit 43df07c5ce77e50d7f5323a950990aff38e53ad1
Author: Gustavo Carneiro <gjc inescporto pt>
Date: Sat Nov 28 18:34:14 2009 +0000
Bug 595566: crash when passing a list with a None value to GConf
gconf/gconf.override | 6 ++++++
tests/testgconf.py | 13 +++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gconf/gconf.override b/gconf/gconf.override
index 496ea7e..738d0fd 100644
--- a/gconf/gconf.override
+++ b/gconf/gconf.override
@@ -256,6 +256,12 @@ pygconf_parse_pygvalue(GConfValueType gvalue_type, PyObject *pyvalue)
*(gdouble*)retval = PyFloat_AsDouble(pyvalue);
break;
case GCONF_VALUE_STRING:
+ if (!PyString_Check(pyvalue)) {
+ PyErr_SetString(PyExc_TypeError,
+ "value should be a string");
+ g_free(retval);
+ return NULL;
+ }
*(gchar**)retval = PyString_AsString(pyvalue);
break;
case GCONF_VALUE_SCHEMA:
diff --git a/tests/testgconf.py b/tests/testgconf.py
new file mode 100644
index 0000000..4a23221
--- /dev/null
+++ b/tests/testgconf.py
@@ -0,0 +1,13 @@
+import unittest
+import common
+import tempfile
+from common import gconf
+
+class GConfTest(unittest.TestCase):
+ def testBug595566(self):
+ c = gconf.Client()
+ self.assertRaises(TypeError, c.set_list, '/test/mec', gconf.VALUE_STRING, [None])
+
+
+if __name__ == '__main__':
+ unittest.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]