[Python-checkins] cpython (3.2): Fix null pointer dereferencing in structmember.c PyMember_SetOne() for T_CHAR.
christian.heimes
python-checkins at python.org
Tue Sep 11 17:31:29 CEST 2012
http://hg.python.org/cpython/rev/afe55cd04119
changeset: 78992:afe55cd04119
branch: 3.2
parent: 78986:8a40bc71c072
user: Christian Heimes <christian at cheimes.de>
date: Tue Sep 11 17:30:53 2012 +0200
summary:
Fix null pointer dereferencing in structmember.c PyMember_SetOne() for T_CHAR. _PyUnicode_AsStringAndSize() can return NULL without touching the len argument. Also remove unnecessary PyUnicode_Check(), _PyUnicode_AsStringAndSize() performance the test again. CID 486815
files:
Python/structmember.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/Python/structmember.c b/Python/structmember.c
--- a/Python/structmember.c
+++ b/Python/structmember.c
@@ -254,12 +254,8 @@
char *string;
Py_ssize_t len;
- if (!PyUnicode_Check(v)) {
- PyErr_BadArgument();
- return -1;
- }
string = _PyUnicode_AsStringAndSize(v, &len);
- if (len != 1) {
+ if (string == NULL || len != 1) {
PyErr_BadArgument();
return -1;
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list