[issue26102] access violation in PyErrFetch if tcur==null in PyGILState_Release

Christian Berger report at bugs.python.org
Wed Jan 13 14:47:51 EST 2016


New submission from Christian Berger:

I've been messing with PyGILState_... handling for my embedded python interpreter and came across this issue:

code in PyGILState_Release:

    PyThreadState *tcur = (PyThreadState *)PyThread_get_key_value(
                                                            autoTLSkey);
    if (tcur == NULL)
        Py_FatalError("auto-releasing thread-state, "
                      "but no thread-state for this thread");

The Py_FatalError() call will then invoke PyErr_Fetch() which won't check if PyThreadState_GET() returns a valid ptr (!= NULL):

PyErr_Fetch(PyObject **p_type, PyObject **p_value, PyObject **p_traceback)
{
    PyThreadState *tstate = PyThreadState_GET();
    *p_type = tstate->curexc_type;

----------
components: Interpreter Core
messages: 258164
nosy: cberger
priority: normal
severity: normal
status: open
title: access violation in PyErrFetch if tcur==null in PyGILState_Release
type: crash
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26102>
_______________________________________


More information about the Python-bugs-list mailing list