#3643 add more checks to _testcapi to prevent segfaults

Author: Victor Stinner
Reviewer: Benjamin Peterson
This commit is contained in:
Benjamin Peterson 2008-08-23 20:32:27 +00:00
parent bc74e5be1a
commit 6784eb79c9
2 changed files with 10 additions and 0 deletions

View File

@ -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?
===========================

View 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);