From 848ee099f5b36650fa7c23ec91110f319e40fd13 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 11 Jul 2013 11:22:21 +0200 Subject: Issue #18426: Fix NULL pointer dereference in C extension import when PyModule_GetDef() returns an error. --- Python/importdl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Python') diff --git a/Python/importdl.c b/Python/importdl.c index 942e4b8d28..e393de153b 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -97,6 +97,8 @@ _PyImport_LoadDynamicModule(PyObject *name, PyObject *path, FILE *fp) /* Remember pointer to module init function. */ def = PyModule_GetDef(m); + if (def == NULL) + goto error; def->m_base.m_init = p; /* Remember the filename as the __file__ attribute */ -- cgit v1.2.1