Mercurial > cpython-lru_cache-weakref
diff Python/getargs.c @ 37697:7ee4068e2c62 legacy-trunk
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.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Fri, 14 Apr 2006 05:20:28 +0000 |
| parents | a4231aa3201a |
| children | 9b22d8b7bcaa |
line wrap: on
line diff
--- a/Python/getargs.c Fri Apr 14 04:54:58 2006 +0000 +++ b/Python/getargs.c Fri Apr 14 05:20:28 2006 +0000 @@ -1042,11 +1042,8 @@ 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 {
