This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alexc
Recipients alexc
Date 2017-03-22.04:14:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490156056.24.0.758776369262.issue29874@psf.upfronthosting.co.za>
In-reply-to
Content
In file selectmodule.c

our static code scanner has reported the following case, function set2list is liable to return NULL (if PyTuple_New failed),  would any chance the NULL pointer be dereferenced (Py_DECREF(fdlist) after set2list) or it would just raise python exception to handle PyTuple_New error ?

static PyObject *
select_select(PyObject *self, PyObject *args)
{
    ......
    if (n < 0) {
        PyErr_SetFromErrno(SelectError);
    }
#endif
    else {
        /* any of these three calls can raise an exception.  it's more
           convenient to test for this after all three calls... but
           is that acceptable?
        */
        ifdlist = set2list(&ifdset, rfd2obj);          //   || <=====
        ofdlist = set2list(&ofdset, wfd2obj);          //   ||
        efdlist = set2list(&efdset, efd2obj);          //   ||
        if (PyErr_Occurred())
            ret = NULL;
        else
            ret = PyTuple_Pack(3, ifdlist, ofdlist, efdlist);

        Py_DECREF(ifdlist);
        Py_DECREF(ofdlist);
        Py_DECREF(efdlist);
History
Date User Action Args
2017-03-22 04:14:16alexcsetrecipients: + alexc
2017-03-22 04:14:16alexcsetmessageid: <1490156056.24.0.758776369262.issue29874@psf.upfronthosting.co.za>
2017-03-22 04:14:16alexclinkissue29874 messages
2017-03-22 04:14:15alexccreate