summaryrefslogtreecommitdiff
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-04-14 05:20:28 +0000
committerNeal Norwitz <nnorwitz@gmail.com>2006-04-14 05:20:28 +0000
commit615461603c3d81a80285299fc3a0dc47d2858864 (patch)
tree988837317073d07610230ed8e56c43c17837176a /Python/getargs.c
parent384178c12d1718cca0b1e84fc85ad2f8d50773ec (diff)
downloadcpython-git-615461603c3d81a80285299fc3a0dc47d2858864.tar.gz
SF Bug #1454485, array.array('u') could crash the interpreter when
passing a string. Martin already fixed the actual crash by ensuring Py_UNICODE is unsigned. As discussed on python-dev, this fix removes the possibility of creating a unicode string from a raw buffer. There is an outstanding question of how to fix the crash in 2.4.
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index e6f607a453..5908e6beba 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1042,11 +1042,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
STORE_SIZE(PyUnicode_GET_SIZE(arg));
}
else {
- char *buf;
- Py_ssize_t count = convertbuffer(arg, p, &buf);
- if (count < 0)
- return converterr(buf, arg, msgbuf, bufsize);
- STORE_SIZE(count/(sizeof(Py_UNICODE)));
+ return converterr("cannot convert raw buffers",
+ arg, msgbuf, bufsize);
}
format++;
} else {