summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-04-01 20:49:45 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-04-03 15:45:15 (GMT)
commit7f6fe4bc968763d50c4b1d61017f9a45927250e9 (patch)
tree11bb5ec4536dc9ab44ef9d6b185467e9da85ea99 /src/corelib/plugin
parent779a0d678fd63d0d26c0c6bda7c3e82dcb8eb75d (diff)
downloadQt-7f6fe4bc968763d50c4b1d61017f9a45927250e9.zip
Qt-7f6fe4bc968763d50c4b1d61017f9a45927250e9.tar.gz
Qt-7f6fe4bc968763d50c4b1d61017f9a45927250e9.tar.bz2
[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.
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qlibrary.cpp14
1 files changed, 14 insertions, 0 deletions
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