This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[python] fix crash in Parameters


If you tried to delete a Parameter's value attribute, gdb would crash.

This isn't valid, so this patch turns it into an exception.

Tom

2008-12-02  Tom Tromey  <tromey@redhat.com>

	* python/python-param.c (set_attr): Don't let user delete the
	value.

diff --git a/gdb/python/python-param.c b/gdb/python/python-param.c
index aad8932..dc1aec3 100644
--- a/gdb/python/python-param.c
+++ b/gdb/python/python-param.c
@@ -244,7 +244,15 @@ set_attr (PyObject *obj, PyObject *attr_name, PyObject *val)
 {
   if (PyString_Check (attr_name)
       && ! strcmp (PyString_AsString (attr_name), "value"))
-    return set_parameter_value ((parmpy_object *) obj, val);
+    {
+      if (!val)
+	{
+	  PyErr_SetString (PyExc_RuntimeError,
+			   "cannot delete a parameter's value");
+	  return -1;
+	}
+      return set_parameter_value ((parmpy_object *) obj, val);
+    }
 
   return PyObject_GenericSetAttr (obj, attr_name, val);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]