Issue 4463: Parameters and result of PyList_GetItem() are not validated (original) (raw)

Python/import.c lines: 1078-1082:

for (j = 0; j < nhooks; j++) {
    PyObject *hook = PyList_GetItem(path_hooks, j);
    if (hook == NULL)
        return NULL;
    importer = PyObject_CallFunctionObjArgs(hook, p, NULL);

The "hook" object is supposed to be a callable, not a string. The code for PyList_GetItem() does its own argument checking.