[issue1950] Potential overflows due to incorrect usage of PyUnicode_AsString.
Alexander Belopolsky
report at bugs.python.org
Fri Mar 7 21:19:24 CET 2008
Alexander Belopolsky added the comment:
I tried to produce a buffer overflow in get_parent (import.c), but an
attempt to import a module with non-ascii characters is aborted in
getargs.c before get_parent is reached:
>>> __import__("\u0080xyz")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __import__() argument 1 must be string without null bytes,
not str
This looks like a bug. At the very least the error message is
misleading because there are no null bytes in "\u0080xyz" string.
The offending code is
if ((Py_ssize_t)strlen(*p) !=
PyUnicode_GetSize(arg))
return converterr("string without null
bytes",
arg, msgbuf, bufsize);
at getargs.c:826
However, given the preceding "XXX WAAAAH!" comment, this is probably a
sign of not yet implemented feature rather than a bug.
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1950>
__________________________________
More information about the Python-bugs-list
mailing list