Hi Jun,


Many thanks for your report. I just created 
https://bitbucket.org/stackless-dev/stackless/issues/129/calling-pytasklet_new-null-crashes
 for your report. It is indeed a regression. I'll fix it soon.

Stay tuned for the upcoming Stackless 3.5.3.



CU Anselm


Von: Stackless [mailto:stackless-boun...@stackless.com] Im Auftrag von Liu, Jun
Gesendet: Mittwoch, 12. April 2017 01:06
An: 'stackless@stackless.com'
Betreff: [Stackless] calling PyTasklet_New( NULL, ...) crashes

Hi,
I am using stackless python 3.4.2.  I'd like to know if anyone that has used 
PyTasklet_New function encountered the same problem when passing in NULL as the 
first argument. According to the documentation,
"PyTaskletObject *PyTasklet_New(PyTypeObject *type, PyObject *func)
Return a new tasklet object. type must be derived from PyTasklet_Type or NULL. 
func must be a callable object (normal use-case) or NULL, if the tasklet is 
being used via capture()."

But it crashes when I pass in NULL as first argument. I looked at the source 
code, and it is:

PyTasklet_New(PyTypeObject *type, PyObject *func)
{
    if (!PyType_IsSubtype(type, &PyTasklet_Type)) {
        PyErr_SetNone(PyExc_TypeError);
        return NULL;
    }
    ......
}


int
PyType_IsSubtype(PyTypeObject *a, PyTypeObject *b)
{
    PyObject *mro;

    mro = a->tp_mro;
                ....
}

So the pointer is dereferenced without being checked thus causing the crash?


Jun
_______________________________________________
Stackless mailing list
Stackless@stackless.com
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to