Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ec4464

Browse files
committed
Issue #18426: Fix NULL pointer dereference in C extension import when
PyModule_GetDef() returns an error.
2 parents 16dbbae + 848ee09 commit 5ec4464

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1?
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #18426: Fix NULL pointer dereference in C extension import when
14+
PyModule_GetDef() returns an error.
15+
1316
- Issue #17206: On Windows, increase the stack size from 2 MB to 4.2 MB to fix
1417
a stack overflow in the marshal module (fix a crash in test_marshal).
1518
Patch written by Jeremy Kloth.

Python/importdl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ _PyImport_LoadDynamicModule(PyObject *name, PyObject *path, FILE *fp)
9797

9898
/* Remember pointer to module init function. */
9999
def = PyModule_GetDef(m);
100+
if (def == NULL)
101+
goto error;
100102
def->m_base.m_init = p;
101103

102104
/* Remember the filename as the __file__ attribute */

0 commit comments

Comments
 (0)