[PyQt] Re: [Pyqwt-users] segfaults on linux and mac with sip 4.7.6

Erick Tryzelaar idadesub at users.sourceforge.net
Sat May 31 03:40:44 BST 2008


On Fri, May 30, 2008 at 7:06 PM, Erick Tryzelaar
<idadesub at users.sourceforge.net> wrote:
> On Fri, May 30, 2008 at 6:42 PM, Erick Tryzelaar
> <idadesub at users.sourceforge.net> wrote:
>> Actually, this is happening because the pyqwt is doing an "import
>> PyQt4.Qt", which is the thing that's actually segfaulting.
>
> It seems like the segfault is occurring in siplib.c at line 3788, in
> the function createType:
>
> 3784:        for (sup = type->td_supers, i = 0; i < nrsupers; ++i, ++sup)
> 3785:        {
> 3786:            PyObject *st = (PyObject *)getClassType(sup, client);
> 3787:
> 3788:            Py_INCREF(st);
> 3789:            PyTuple_SET_ITEM(bases,i,st);
> 3790:        }
>
> According to gdb, getClassType is returning 0, but I'm not sure why yet.
>

On Fri, May 30, 2008 at 7:06 PM, Erick Tryzelaar
<idadesub at users.sourceforge.net> wrote:
> On Fri, May 30, 2008 at 6:42 PM, Erick Tryzelaar
> <idadesub at users.sourceforge.net> wrote:
>> Actually, this is happening because the pyqwt is doing an "import
>> PyQt4.Qt", which is the thing that's actually segfaulting.
>
> It seems like the segfault is occurring in siplib.c at line 3788, in
> the function createType:

So digging a bit further, this is the code we're interested in:

static sipExportedModuleDef *getClassModule(sipEncodedClassDef *enc,
        sipExportedModuleDef *em)
{
    if (enc->sc_module != 255)
        em = em->em_imports[enc->sc_module].im_module;

    return em;
}

static sipWrapperType *getClassType(sipEncodedClassDef *enc,
        sipExportedModuleDef *em)
{
    return getClassModule(enc, em)->em_types[enc->sc_class];
}

client has this data:

sc_class = 251
sc_module = 1
sc_flag = 1

So, if we evaluate everything out, we have this expression:

client->em_imports[sup->sc_module].im_module->em_types[sup->sc_class]

So, I see that client->em_name is PyQt4.QtWebKit, and the sc_module=1,
and that value is PyQt4.QtNetwork from it's im_name field. It then
tries to find in em_types the 251st index. However:

client->em_imports[sup->sc_module].im_module->em_nrtypes

equals 32. If I'm reading that correctly, it's trying to read a value
that's way past the end of the em_types field. I'm not sure how this
can be happening though.


More information about the PyQt mailing list