]> granicus.if.org Git - python/commitdiff
Issue #18426: Fix NULL pointer dereference in C extension import when
authorChristian Heimes <christian@cheimes.de>
Thu, 11 Jul 2013 09:22:21 +0000 (11:22 +0200)
committerChristian Heimes <christian@cheimes.de>
Thu, 11 Jul 2013 09:22:21 +0000 (11:22 +0200)
PyModule_GetDef() returns an error.

Misc/NEWS
Python/importdl.c

index 63d49693d7d788a7aa411482747a48110366a6bf..4d55853af7f961509aad6e4e953938f7480b2cb8 100644 (file)
--- 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.
 
index 942e4b8d28f6e09f19aa574490716e29dd23c482..e393de153bae71388b3647572bbdcd4a084f3e0b 100644 (file)
@@ -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 */