[issue12764] segfault in ctypes.Struct with bad _fields_

Amaury Forgeot d'Arc report at bugs.python.org
Tue Aug 16 22:21:57 CEST 2011


New submission from Amaury Forgeot d'Arc <amauryfa at gmail.com>:

This crashes on python 3.3::

   class S(ctypes.Structure):
       _fields_ = [(b'x', ctypes.c_int)]

This also crashes on python 2.7::

   class S(ctypes.Structure):
       _fields_ = [(u'x\xe9', ctypes.c_int)]

The cause is the same: in Modules/_ctypes/stgdict.c, the assignment 
    fieldname = _PyUnicode_AsString(name);
does not check for errors.

----------
components: ctypes
keywords: easy
messages: 142218
nosy: amaury.forgeotdarc
priority: normal
severity: normal
status: open
title: segfault in ctypes.Struct with bad _fields_
type: crash

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


More information about the Python-bugs-list mailing list