[New-bugs-announce] [issue4367] Patch for segmentation fault in ast_for_atom
report at bugs.python.org
Thu Nov 20 18:36:07 CET 2008
New submission from Giuseppe Ottaviano <giuott at gmail.com>:
trying to compile Python 2.6 I got a segmentation fault while
byte-compiling the modules.
The segmentation fault happened in ast_for_atom, parsing an Unicode
entity. I found out that another problem prevented unicodedata to be
imported, so unicode_decode raised an exception. I think the problem is
in the following lines:
PyObject *type, *value, *tback, *errstr;
PyErr_Fetch(&type, &value, &tback);
errstr = ((PyUnicodeErrorObject *)value)->reason;
I'm not an expert of CPython internals, but the exception is raised with
PyErr_SetString, so value is a PyStringObject, and that cast is invalid.
Changing the last line to
errstr = value;
The patch is attached.
title: Patch for segmentation fault in ast_for_atom
versions: Python 2.6
Added file: http://bugs.python.org/file12075/ast.patch
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce