Issue 4462: result of PyList_GetItem() not validated (original) (raw)

PyObject *hook = PyList_GetItem(meta_path, i); loader = PyObject_CallMethod(hook, "find_module", "sO", fullname, path != NULL ? path : Py_None);

The "hook" pointer is checked for NULL in PyObject_CallMethod() -- see line 1947 in Objects/abstract.c. The hook is a general object (hopefully with a find_module() method), not a string.