[PyQt] Py_XDECREF(*sipUnused) Segfault
Phil Thompson
phil at riverbankcomputing.com
Tue Jun 8 16:55:30 BST 2010
On Tue, 08 Jun 2010 17:17:08 +0200, Matteo Bertozzi <th30z at develer.com>
wrote:
> I've a segfault for a NULL pointer access:
> Py_XDECREF(*sipUnused);
>
> The code to reproduce segfault is really simple:
> Method code set sipIsError to True and raise PyExc_ValueError.
>
> ____(sipSimpleWrapper *, PyObject *sipArgs, PyObject *sipKwds, PyObject
> **sipUnused, PyObject **, PyObject **sipParseErr)
>
> sipUnused seems to be NULL, and Py_XDECREF(*sipUnused)
> try to access to address 0... and the result is a segfault.
>
> A very simple workaround can be check sipUnused before call Py_XDECREF.
>
>> --- sip/sipgen/gencode.c (revision 29039)
>> +++ sip/sipgen/gencode.c (working copy)
>> @@ -10294,7 +10294,7 @@
>>
>> prcode(fp,
>> "\n"
>> -" Py_XDECREF(*sipUnused);\n"
>> +" if (sipUnused != NULL) Py_XDECREF(*sipUnused);\n"
>> " sipAddException(sipError, sipParseErr);\n"
>> "\n"
>> " if (sipError == sipErrorFail)\n"
>> @@ -10308,7 +10308,7 @@
>> prcode(fp,
>> " if (sipIsErr)\n"
>> " {\n"
>> -" Py_XDECREF(*sipUnused);\n"
>> +" if (sipUnused != NULL) Py_XDECREF(*sipUnused);\n"
>> " sipAddException(sipErrorFail, sipParseErr);\n"
>> " return NULL;\n"
>> " }\n"
>
> Thanks.
Should be fixed in tonight's snapshot - thanks.
Phil
More information about the PyQt
mailing list