From 7f6fe4bc968763d50c4b1d61017f9a45927250e9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Apr 2010 22:49:45 +0200 Subject: [plugins] Don't conclude that a .debug file is a plugin. On Unix systems (that are not Mac), the Qt buildsystem splits the code from the debug symbols using objcopy. The resulting .debug file contains a valid ELF header, with a copy of the main library's section headers. But the contents of those sections are missing. When we try to dlopen(3) those libraries, libdl crashes. So we shouldn't try to open those files. --- src/corelib/plugin/qlibrary.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index a2c575a..0f99948 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -620,6 +620,20 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) QByteArray key; bool success = false; +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) + if (fileName.endsWith(QLatin1String(".debug"))) { + // refuse to load a file that ends in .debug + // these are the debug symbols from the libraries + // the problem is that they are valid shared library files + // and dlopen is known to crash while opening them + + // pretend we didn't see the file + errorString = QLibrary::tr("The shared library was not found."); + pluginState = IsNotAPlugin; + return false; + } +#endif + QFileInfo fileinfo(fileName); #ifndef QT_NO_DATESTRING -- cgit v0.12