Skip to content

Commit 850f4bc

Browse files
author
neal.norwitz
committed
- SF Bug #1350188, "setdlopenflags" leads to crash upon "import"
It was possible dlerror() returns a NULL pointer, use a default error message in this case. git-svn-id: http://svn.python.org/projects/python/trunk@41412 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent b4eb00d commit 850f4bc

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ What's New in Python 2.5 alpha 1?
1212
Core and builtins
1313
-----------------
1414

15+
- SF Bug #1350188, "setdlopenflags" leads to crash upon "import"
16+
It was possible dlerror() returns a NULL pointer, use a default error
17+
message in this case.
18+
1519
- Replaced most Unicode charmap codecs with new ones using the
1620
new Unicode translate string feature in the builtin charmap
1721
codec; the codecs were created from the mapping tables available

Python/dynload_shlib.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
130130
handle = dlopen(pathname, dlopenflags);
131131

132132
if (handle == NULL) {
133-
PyErr_SetString(PyExc_ImportError, dlerror());
133+
char *error = dlerror();
134+
if (error == NULL)
135+
error = "unknown dlopen() error";
136+
PyErr_SetString(PyExc_ImportError, error);
134137
return NULL;
135138
}
136139
if (fp != NULL && nhandles < 128)

0 commit comments

Comments
 (0)