STINNER Victor <victor.stin...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue6697>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to