do some security checks to make sure Py::Module is valid

This commit is contained in:
wmayer
2019-06-03 17:57:52 +02:00
parent 9660b1fb1e
commit 85fddfc54a
3 changed files with 20 additions and 2 deletions

View File

@@ -1038,6 +1038,10 @@ PyObject* Application::sAddCommand(PyObject * /*self*/, PyObject *args)
try {
Base::PyGILStateLocker lock;
Py::Module mod(PyImport_ImportModule("inspect"), true);
if (mod.isNull()) {
PyErr_SetString(PyExc_ImportError, "Cannot load inspect module");
return 0;
}
Py::Callable inspect(mod.getAttr("stack"));
Py::Tuple args;
Py::List list(inspect.apply(args));