summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-11 09:22:21 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-11 09:22:21 (GMT)
commit848ee099f5b36650fa7c23ec91110f319e40fd13 (patch)
treeccff8a4619b8d2dbd91b0f4a6b1150aa038636bc
parent87ead1138d11c92139182524eb50965fc652179f (diff)
downloadcpython-848ee099f5b36650fa7c23ec91110f319e40fd13.zip
cpython-848ee099f5b36650fa7c23ec91110f319e40fd13.tar.gz
cpython-848ee099f5b36650fa7c23ec91110f319e40fd13.tar.bz2
Issue #18426: Fix NULL pointer dereference in C extension import when
PyModule_GetDef() returns an error.
-rw-r--r--Misc/NEWS3
-rw-r--r--Python/importdl.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 63d4969..4d55853 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 3.3.3 release candidate 1?
Core and Builtins
-----------------
+- Issue #18426: Fix NULL pointer dereference in C extension import when
+ PyModule_GetDef() returns an error.
+
- Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now the
tstate is first removed from TLS and then deallocated.
diff --git a/Python/importdl.c b/Python/importdl.c
index 942e4b8..e393de1 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 */