summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qpluginloader.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-07-02 22:38:57 -0700
committerSimon Hausmann <simon.hausmann@qt.io>2018-07-19 07:27:02 +0000
commit8a5267e4d96438aa74672ca1bf25d187c6c45bd2 (patch)
treeabb5b76025fac8489a68fae3d61708ba3c3ef930 /src/corelib/plugin/qpluginloader.cpp
parent3c2ffd7457688bd8ae9d5fca688843e2029504b2 (diff)
Plugins: fix crash if the binary JSON data contains invalid size
Eight bytes into the Binary JSON header there's a 32-bit little-endian size, which qJsonFromRawLibraryMetaData uses to determine the size of the stored metadata. That value is passed as a size to QByteArray, which means certain values could cause crashes due to being too big or via sign-extension in 64-bit. [ChangeLog][QtCore][QPluginLoader] Fixed an issue that could cause a crash when certain damaged or corrupt plugin files were scanned. Change-Id: I117816bf0f5e469b8d34fffd153dc5425cec39a7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/corelib/plugin/qpluginloader.cpp')
-rw-r--r--src/corelib/plugin/qpluginloader.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index aab00cc7eb6..83cbcd2b44e 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -474,7 +475,10 @@ QVector<QStaticPlugin> QPluginLoader::staticPlugins()
*/
QJsonObject QStaticPlugin::metaData() const
{
- return qJsonFromRawLibraryMetaData(rawMetaData()).object();
+ // the data is already loaded, so this doesn't matter
+ qsizetype rawMetaDataSize = INT_MAX;
+
+ return qJsonFromRawLibraryMetaData(rawMetaData(), rawMetaDataSize).object();
}
QT_END_NAMESPACE