[issue6697] Check that _PyUnicode_AsString() result is not NULL

STINNER Victor report at bugs.python.org
Fri Mar 5 02:02:04 CET 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

Here is a fix for object.c (object_pyunicode_asstring-py3k.patch):

- PyObject_GenericGetAttr(): Replace PyErr_Format("... %.400s", ..., _PyUnicode_AsString(name)) by PyErr_Format("... %U", ..., name), as done in PyObject_GenericSetAttr(). Note that the string will no more be truncated to 400 bytes
- PyObject_GetAttr(), PyObject_SetAttr(): Catch _PyUnicode_AsString() error

It fixes the crash getattr(1, "\uDAD1\uD51E") (used as a test in the patch).

----------
title: Python 3.1 segfaults when invalid UTF-8 characters are	passed from command line -> Check that _PyUnicode_AsString() result is not NULL
Added file: http://bugs.python.org/file16442/object_pyunicode_asstring-py3k.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6697>
_______________________________________


More information about the Python-bugs-list mailing list