classification
Title: dlopen() error with no error message from dlerror()
Type: crash Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: theller Nosy List: haypo, theller
Priority: normal Keywords: patch

Created on 2008-07-07 13:24 by haypo, last changed 2008-07-15 19:50 by theller. This issue is now closed.

Files
File name Uploaded Description Edit
dl_open.patch haypo, 2008-07-07 13:24 Patch to fix dl_open()
ctypes_dlopen.patch haypo, 2008-07-08 13:45 Patch to fix _ctypes.dlopen()
Messages (4)
msg69388 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2008-07-07 13:24
Python dl_open() function (from dl module) calls dlopen() and check 
its result: if it's NULL, it's an error. This is correct if I read the 
man page. But with an invalid flag value (-1), dlopen() returns NULL 
but dlerror() also gives a NULL pointer. Example:

>>> import dl
>>> dl.open("/usr/lib/libm.so", -1)
Erreur de segmentation (core dumped)

Workaround: use a static error message if dlerror() returns NULL.

I wrote a patch for dl_open() but other functions (in ctypes module?) 
should also call dlerror().
msg69432 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2008-07-08 13:45
As expected, the bug can be reproduced with ctypes.dlopen(). 
py_dl_open() function of Modules/_ctypes/callproc.c should be merged 
with Modules/dlmodule.c.

Here use at least the attached patch for ctypes (same job than the 
other patch: use default string if dlerror() returns NULL).
msg69703 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-07-15 18:35
I can confirm the problem on ubuntu linux.
msg69713 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-07-15 19:50
Thanks for the patch, fixed in trunk rev 64977 and py3k rev 64978.
History
Date User Action Args
2008-07-15 19:50:14thellersetstatus: open -> closed
resolution: fixed
messages: + msg69713
2008-07-15 18:35:11thellersetassignee: theller
messages: + msg69703
nosy: + theller
2008-07-08 13:45:57hayposetfiles: + ctypes_dlopen.patch
messages: + msg69432
2008-07-07 13:24:31haypocreate