mirror of
https://github.com/python/cpython.git
synced 2025-07-28 13:44:43 +00:00
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.
This commit is contained in:
parent
384178c12d
commit
615461603c
2 changed files with 9 additions and 5 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue