[PyQt] Py_XDECREF(*sipUnused) Segfault
Matteo Bertozzi
th30z at develer.com
Tue Jun 8 16:17:08 BST 2010
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sip-unused-decref.tar.bz2
Type: application/x-bzip-compressed-tar
Size: 1185 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100608/6625313a/attachment.bin>
More information about the PyQt
mailing list