]> granicus.if.org Git - python/commitdiff
#3643 add more checks to _testcapi to prevent segfaults
authorBenjamin Peterson <benjamin@python.org>
Sat, 23 Aug 2008 20:32:27 +0000 (20:32 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sat, 23 Aug 2008 20:32:27 +0000 (20:32 +0000)
Author: Victor Stinner
Reviewer: Benjamin Peterson

Misc/NEWS
Modules/_testcapimodule.c

index 83f1c9614905e1172b6e2348954d7c77b8d92877..ae40187951db72d11c92350aa15770ce45515547 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -17,6 +17,12 @@ Core and Builtins
 Library
 -------
 
+Extension Modules
+-----------------
+
+- Issue #3643: Added a few more checks to _testcapi to prevent segfaults by
+  exploitation of poor argument checking.
+
 
 What's new in Python 3.0b3?
 ===========================
index 494937aa4e17f9a93904dc8d6f9d930a9e3e3fff..995d789cfa6ddd4cb426b73bcda85b4ec73f497b 100644 (file)
@@ -961,6 +961,10 @@ exception_print(PyObject *self, PyObject *args)
        if (!PyArg_ParseTuple(args, "O:exception_print",
                                &value))
                return NULL;
+       if (!PyExceptionInstance_Check(value)) {
+               PyErr_Format(PyExc_TypeError, "an exception instance is required");
+               return NULL;
+       }
 
        tb = PyException_GetTraceback(value);
        PyErr_Display((PyObject *) Py_TYPE(value), value, tb);