Bug#518131: libqt4-opengl: dlclose libQtOpenGL.so segmentation fault
Package: libqt4-opengl
Version: 4.5.0~rc1-2
Severity: minor
If libQtOpenGL is loaded with dlopen the program segfaults when libQtOpenGL is unloaded.
$ gcc -o dltest -ldl dltest.c
$ ./dltest /usr/lib/libQtOpenGL.so
opening /usr/lib/libQtOpenGL.so...
closing /usr/lib/libQtOpenGL.so...
Segmentation fault (core dumped)
My build from upstream links against GLU and does not crash on dlclose.
$ ldd /usr/lib/libQtOpenGL.so | grep GLU
$ ldd /usr/local/Trolltech/Qt-4.5.0/lib/libQtOpenGL.so | grep GLU
libGLU.so.1 => /usr/lib/libGLU.so.1 (0xb7e01000)
Linking libqt4-opengl against GLU should fix it.
$ ./dltest /usr/lib/libGLU.so /usr/lib/libQtOpenGL.so
opening /usr/lib/libGLU.so...
opening /usr/lib/libQtOpenGL.so...
closing /usr/lib/libQtOpenGL.so...
closing /usr/lib/libGLU.so...
done
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=de_CH.UTF-8, LC_CTYPE=de_CH.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libqt4-opengl depends on:
ii libc6 2.9-4 GNU C Library: Shared libraries
ii libfreetype6 2.3.7-2 FreeType 2 font engine, shared lib
ii libgcc1 1:4.3.3-3 GCC support library
ii libgl1-mesa-glx [libgl1] 7.2-1 A free implementation of the OpenG
ii libqtcore4 4.5.0~rc1-2 Qt 4 core module
ii libqtgui4 4.5.0~rc1-2 Qt 4 GUI module
ii libstdc++6 4.3.3-3 The GNU Standard C++ Library v3
ii libx11-6 2:1.1.5-2 X11 client-side library
libqt4-opengl recommends no packages.
libqt4-opengl suggests no packages.
-- no debconf information
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <error.h>
int
main(int argc, char** argv)
{
if (argc < 2)
error(EXIT_FAILURE, 0, "usage: %s LIBRARY...", argv[0]);
void* handle[argc];
int i;
for (i=1; i < argc; i++)
{
printf("opening %s...\n", argv[i]);
handle[i] = dlopen(argv[i], RTLD_LAZY);
if (!handle[i])
error(EXIT_FAILURE, 0, "dlopen: %s", dlerror());
}
for (i=argc-1; i > 0; i--)
{
printf("closing %s...\n", argv[i]);
if(dlclose(handle[i]))
error(EXIT_FAILURE, 0, "dlclose: %s", dlerror());
}
printf("done\n");
exit(EXIT_SUCCESS);
}
Reply to: