[Python-3000-checkins] r66001 - in python/branches/py3k: Misc/NEWS Modules/_testcapimodule.c

benjamin.peterson python-3000-checkins at python.org
Sat Aug 23 22:32:28 CEST 2008


Author: benjamin.peterson
Date: Sat Aug 23 22:32:27 2008
New Revision: 66001

Log:
#3643 add more checks to _testcapi to prevent segfaults

Author: Victor Stinne
Reviewer: Benjamin Peterson


Modified:
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Modules/_testcapimodule.c

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sat Aug 23 22:32:27 2008
@@ -17,6 +17,12 @@
 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?
 ===========================

Modified: python/branches/py3k/Modules/_testcapimodule.c
==============================================================================
--- python/branches/py3k/Modules/_testcapimodule.c	(original)
+++ python/branches/py3k/Modules/_testcapimodule.c	Sat Aug 23 22:32:27 2008
@@ -961,6 +961,10 @@
 	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);


More information about the Python-3000-checkins mailing list