[issue13096] ctypes: segfault with large POINTER type names

Brian Brazil report at bugs.python.org
Sun Oct 9 16:27:03 CEST 2011


Brian Brazil <brian.brazil at gmail.com> added the comment:

The problem is around line 1734 of callproc.c in tip:

    } else if (PyType_Check(cls)) {
        typ = (PyTypeObject *)cls;
        buf = alloca(strlen(typ->tp_name) + 3 + 1);
        sprintf(buf, "LP_%s", typ->tp_name);   <-- segfault is here

Replacing the alloca with a malloc fixes it, so I presume it's hitting the stack size limit as 2^25 is 32MB (my stack limit is 8MB).

----------
nosy: +bbrazil

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


More information about the Python-bugs-list mailing list