Kaydet (Commit) 6784eb79 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

#3643 add more checks to _testcapi to prevent segfaults

Author: Victor Stinner
Reviewer: Benjamin Peterson
üst bc74e5be
...@@ -17,6 +17,12 @@ Core and Builtins ...@@ -17,6 +17,12 @@ Core and Builtins
Library 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? What's new in Python 3.0b3?
=========================== ===========================
......
...@@ -961,6 +961,10 @@ exception_print(PyObject *self, PyObject *args) ...@@ -961,6 +961,10 @@ exception_print(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O:exception_print", if (!PyArg_ParseTuple(args, "O:exception_print",
&value)) &value))
return NULL; return NULL;
if (!PyExceptionInstance_Check(value)) {
PyErr_Format(PyExc_TypeError, "an exception instance is required");
return NULL;
}
tb = PyException_GetTraceback(value); tb = PyException_GetTraceback(value);
PyErr_Display((PyObject *) Py_TYPE(value), value, tb); PyErr_Display((PyObject *) Py_TYPE(value), value, tb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment