[Python-checkins] r78435 - in python/branches/py3k: Misc/NEWS Modules/_ctypes/callproc.c
larry.hastings
python-checkins at python.org
Wed Feb 24 23:49:58 CET 2010
Author: larry.hastings
Date: Wed Feb 24 23:49:58 2010
New Revision: 78435
Log:
Issue #5939: Add additional runtime checking to ensure a valid capsule
in Modules/_ctypes/callproc.c. Reviewed by Benjamin P. My first commit!
Modified:
python/branches/py3k/Misc/NEWS
python/branches/py3k/Modules/_ctypes/callproc.c
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Wed Feb 24 23:49:58 2010
@@ -12,6 +12,9 @@
Core and Builtins
-----------------
+- Issue #5939: Add additional runtime checking to ensure a valid capsule
+ in Modules/_ctypes/callproc.c.
+
- Issue #7309: Fix unchecked attribute access when converting
UnicodeEncodeError, UnicodeDecodeError, and UnicodeTranslateError to
strings.
Modified: python/branches/py3k/Modules/_ctypes/callproc.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/callproc.c (original)
+++ python/branches/py3k/Modules/_ctypes/callproc.c Wed Feb 24 23:49:58 2010
@@ -139,8 +139,14 @@
return NULL;
}
errobj = PyDict_GetItem(dict, error_object_name);
- if (errobj)
+ if (errobj) {
+ if (!PyCapsule_IsValid(errobj, CTYPES_CAPSULE_NAME_PYMEM)) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "ctypes.error_object is an invalid capsule");
+ return NULL;
+ }
Py_INCREF(errobj);
+ }
else {
void *space = PyMem_Malloc(sizeof(int) * 2);
if (space == NULL)
More information about the Python-checkins
mailing list