summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2020-01-28 09:16:11 +0100
committerLiang Qi <liang.qi@qt.io>2020-01-28 09:16:11 +0100
commit54b1f1d199eb0d03883240bcbb688fc3051005f0 (patch)
tree40277c535779db90c690a1e05fcbbc21c90b7454 /src
parent1ed802e3b8a7f236bd277719090f461a87eae78e (diff)
parent0ab53fbdda2fd7f24f45dcd52fbd195e282554da (diff)
Merge remote-tracking branch 'origin/5.14.1' into 5.14
Conflicts: mkspecs/features/create_cmake.prf Done-With: Artem Pisarenko <artem.k.pisarenko@gmail.com> Change-Id: I2ecb9fdca06fe687be8ab3457a58dd81e5e81c4c
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/sqlite/patches/0006-Fix-CVE-2019-19880-in-SQLite.patch30
-rw-r--r--src/3rdparty/sqlite/sqlite3.c2
-rw-r--r--src/corelib/kernel/qmetatype.h88
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp4
-rw-r--r--src/corelib/plugin/qpluginloader.cpp2
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp2
-rw-r--r--src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp11
-rw-r--r--src/tools/androiddeployqt/main.cpp2
10 files changed, 122 insertions, 26 deletions
diff --git a/src/3rdparty/sqlite/patches/0006-Fix-CVE-2019-19880-in-SQLite.patch b/src/3rdparty/sqlite/patches/0006-Fix-CVE-2019-19880-in-SQLite.patch
new file mode 100644
index 0000000000..fc1c6778c3
--- /dev/null
+++ b/src/3rdparty/sqlite/patches/0006-Fix-CVE-2019-19880-in-SQLite.patch
@@ -0,0 +1,30 @@
+From 423d82ac8c7c545e8eac6f70a3e5e92208b7d991 Mon Sep 17 00:00:00 2001
+From: Andy Shaw <andy.shaw@qt.io>
+Date: Tue, 21 Jan 2020 15:15:00 +0100
+Subject: [PATCH] Fix CVE-2019-19880 in SQLite
+
+Fixes: QTBUG-81565
+Change-Id: I6bf2364e696315e5262d1abfa2f0b6947f14a33b
+---
+ src/3rdparty/sqlite/sqlite3.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
+index d5b43857ad..cd1a4d5221 100644
+--- a/src/3rdparty/sqlite/sqlite3.c
++++ b/src/3rdparty/sqlite/sqlite3.c
+@@ -147620,9 +147620,11 @@ static ExprList *exprListAppendList(
+ int nInit = pList ? pList->nExpr : 0;
+ for(i=0; i<pAppend->nExpr; i++){
+ Expr *pDup = sqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0);
++ assert( pDup==0 || !ExprHasProperty(pDup, EP_MemToken) );
+ if( bIntToNull && pDup && pDup->op==TK_INTEGER ){
+ pDup->op = TK_NULL;
+ pDup->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse);
++ pDup->u.zToken = 0;
+ }
+ pList = sqlite3ExprListAppend(pParse, pList, pDup);
+ if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags;
+--
+2.21.0 (Apple Git-122.2)
+
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index d5b43857ad..cd1a4d5221 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -147620,9 +147620,11 @@ static ExprList *exprListAppendList(
int nInit = pList ? pList->nExpr : 0;
for(i=0; i<pAppend->nExpr; i++){
Expr *pDup = sqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0);
+ assert( pDup==0 || !ExprHasProperty(pDup, EP_MemToken) );
if( bIntToNull && pDup && pDup->op==TK_INTEGER ){
pDup->op = TK_NULL;
pDup->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse);
+ pDup->u.zToken = 0;
}
pList = sqlite3ExprListAppend(pParse, pList, pDup);
if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags;
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index d41f7ee80e..d13fdeb642 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -977,6 +977,30 @@ enum IteratorCapability
RandomAccessCapability = 4
};
+enum ContainerCapability
+{
+ ContainerIsAppendable = 1
+};
+
+template<typename Container, typename T = void>
+struct ContainerCapabilitiesImpl
+{
+ enum {ContainerCapabilities = 0};
+ using appendFunction = void(*)(const void *container, const void *newElement);
+ static constexpr const appendFunction appendImpl = nullptr;
+};
+
+template<typename Container>
+struct ContainerCapabilitiesImpl<Container, decltype(std::declval<Container>().push_back(std::declval<typename Container::value_type>()))>
+{
+ enum {ContainerCapabilities = ContainerIsAppendable};
+
+ // The code below invokes undefined behavior if and only if the pointer passed into QSequentialIterableImpl
+ // pointed to a const object to begin with
+ static void appendImpl(const void *container, const void *value)
+ { static_cast<Container *>(const_cast<void *>(container))->push_back(*static_cast<const typename Container::value_type *>(value)); }
+};
+
template<typename T, typename Category = typename std::iterator_traits<typename T::const_iterator>::iterator_category>
struct CapabilitiesImpl;
@@ -1012,6 +1036,12 @@ template<typename T>
struct ContainerAPI<std::list<T> > : CapabilitiesImpl<std::list<T> >
{ static int size(const std::list<T> *t) { return int(t->size()); } };
+/*
+ revision 0: _iteratorCapabilities is simply a uint, where the bits at _revision were never set
+ revision 1: _iteratorCapabilties is treated as a bitfield, the remaining bits are used to introduce
+ _revision, _containerCapabilities and _unused. The latter contains 21 bits that are
+ not used yet
+*/
class QSequentialIterableImpl
{
public:
@@ -1020,19 +1050,37 @@ public:
int _metaType_id;
uint _metaType_flags;
uint _iteratorCapabilities;
+ // Iterator capabilities looks actually like
+ // uint _iteratorCapabilities:4;
+ // uint _revision:3;
+ // uint _containerCapabilities:4;
+ // uint _unused:21;*/
typedef int(*sizeFunc)(const void *p);
typedef const void * (*atFunc)(const void *p, int);
typedef void (*moveIteratorFunc)(const void *p, void **);
+ enum Position { ToBegin, ToEnd };
+ typedef void (*moveIteratorFunc2)(const void *p, void **, Position position);
typedef void (*advanceFunc)(void **p, int);
typedef VariantData (*getFunc)( void * const *p, int metaTypeId, uint flags);
typedef void (*destroyIterFunc)(void **p);
typedef bool (*equalIterFunc)(void * const *p, void * const *other);
typedef void (*copyIterFunc)(void **, void * const *);
+ typedef void(*appendFunction)(const void *container, const void *newElement);
+
+ IteratorCapability iteratorCapabilities() {return static_cast<IteratorCapability>(_iteratorCapabilities & 0xF);}
+ uint revision() {return _iteratorCapabilities >> 4 & 0x7;}
+ uint containerCapabilities() {return _iteratorCapabilities >> 7 & 0xF;}
sizeFunc _size;
atFunc _at;
- moveIteratorFunc _moveToBegin;
- moveIteratorFunc _moveToEnd;
+ union {
+ moveIteratorFunc _moveToBegin;
+ moveIteratorFunc2 _moveTo;
+ };
+ union {
+ moveIteratorFunc _moveToEnd;
+ appendFunction _append;
+ };
advanceFunc _advance;
getFunc _get;
destroyIterFunc _destroyIter;
@@ -1059,6 +1107,15 @@ public:
static void moveToEndImpl(const void *container, void **iterator)
{ IteratorOwner<typename T::const_iterator>::assign(iterator, static_cast<const T*>(container)->end()); }
+ template<class Container>
+ static void moveToImpl(const void *container, void **iterator, Position position)
+ {
+ if (position == ToBegin)
+ moveToBeginImpl<Container>(container, iterator);
+ else
+ moveToEndImpl<Container>(container, iterator);
+ }
+
template<class T>
static VariantData getImpl(void * const *iterator, int metaTypeId, uint flags)
{ return VariantData(metaTypeId, IteratorOwner<typename T::const_iterator>::getData(iterator), flags); }
@@ -1069,11 +1126,11 @@ public:
, _iterator(nullptr)
, _metaType_id(qMetaTypeId<typename T::value_type>())
, _metaType_flags(QTypeInfo<typename T::value_type>::isPointer)
- , _iteratorCapabilities(ContainerAPI<T>::IteratorCapabilities)
+ , _iteratorCapabilities(ContainerAPI<T>::IteratorCapabilities | (1 << 4) | (ContainerCapabilitiesImpl<T>::ContainerCapabilities << (4+3)))
, _size(sizeImpl<T>)
, _at(atImpl<T>)
- , _moveToBegin(moveToBeginImpl<T>)
- , _moveToEnd(moveToEndImpl<T>)
+ , _moveTo(moveToImpl<T>)
+ , _append(ContainerCapabilitiesImpl<T>::appendImpl)
, _advance(IteratorOwner<typename T::const_iterator>::advance)
, _get(getImpl<T>)
, _destroyIter(IteratorOwner<typename T::const_iterator>::destroy)
@@ -1087,7 +1144,7 @@ public:
, _iterator(nullptr)
, _metaType_id(QMetaType::UnknownType)
, _metaType_flags(0)
- , _iteratorCapabilities(0)
+ , _iteratorCapabilities(0 | (1 << 4) ) // no iterator capabilities, revision 1
, _size(nullptr)
, _at(nullptr)
, _moveToBegin(nullptr)
@@ -1100,8 +1157,18 @@ public:
{
}
- inline void moveToBegin() { _moveToBegin(_iterable, &_iterator); }
- inline void moveToEnd() { _moveToEnd(_iterable, &_iterator); }
+ inline void moveToBegin() {
+ if (revision() == 0)
+ _moveToBegin(_iterable, &_iterator);
+ else
+ _moveTo(_iterable, &_iterator, ToBegin);
+ }
+ inline void moveToEnd() {
+ if (revision() == 0)
+ _moveToEnd(_iterable, &_iterator);
+ else
+ _moveTo(_iterable, &_iterator, ToEnd);
+ }
inline bool equal(const QSequentialIterableImpl&other) const { return _equalIter(&_iterator, &other._iterator); }
inline QSequentialIterableImpl &advance(int i) {
Q_ASSERT(i > 0 || _iteratorCapabilities & BiDirectionalCapability);
@@ -1109,6 +1176,11 @@ public:
return *this;
}
+ inline void append(const void *newElement) {
+ if (containerCapabilities() & ContainerIsAppendable)
+ _append(_iterable, newElement);
+ }
+
inline VariantData getCurrent() const { return _get(&_iterator, _metaType_id, _metaType_flags); }
VariantData at(int idx) const
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index f0de1010d7..135b82cd37 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2018 Intel Corporation
+** Copyright (C) 2020 Intel Corporation
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -218,6 +218,8 @@ bool QLibraryPrivate::load_sys()
for(int suffix = 0; retry && !pHnd && suffix < suffixes.size(); suffix++) {
if (!prefixes.at(prefix).isEmpty() && name.startsWith(prefixes.at(prefix)))
continue;
+ if (path.isEmpty() && prefixes.at(prefix).contains(QLatin1Char('/')))
+ continue;
if (!suffixes.at(suffix).isEmpty() && name.endsWith(suffixes.at(suffix)))
continue;
if (loadHints & QLibrary::LoadArchiveMemberHint) {
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index c2443dbdda..dac8502dae 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -342,7 +342,7 @@ static QString locatePlugin(const QString& fileName)
QPluginLoader will automatically look for the file with the appropriate
suffix (see QLibrary::isLibrary()).
- When loading the plugin, QPluginLoader searches in the current directory and
+ When loading the plugin, QPluginLoader searches
in all plugin locations specified by QCoreApplication::libraryPaths(),
unless the file name has an absolute path. After loading the plugin
successfully, fileName() returns the fully-qualified file name of
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index fde6bb0180..671c2d93ef 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -535,7 +535,7 @@ void QHighDpiScaling::updateHighDpiScaling()
++i;
}
}
- m_active = m_globalScalingActive || m_screenFactorSet || m_usePixelDensity;
+ m_active = m_globalScalingActive || m_screenFactorSet || m_pixelDensityScalingActive;
}
/*
diff --git a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
index fcc08ea00d..625473964d 100644
--- a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
+++ b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
@@ -146,7 +146,7 @@ public:
jobjectArray jFiles = static_cast<jobjectArray>(files.object());
const jint nFiles = env->GetArrayLength(jFiles);
for (int i = 0; i < nFiles; ++i) {
- AssetItem item{QJNIObjectPrivate(env->GetObjectArrayElement(jFiles, i)).toString()};
+ AssetItem item{QJNIObjectPrivate::fromLocalRef(env->GetObjectArrayElement(jFiles, i)).toString()};
insert(std::upper_bound(begin(), end(), item, [](const auto &a, const auto &b){
return a.name < b.name;
}), item);
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index ea91e3bb2d..496b18ba1a 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1935,12 +1935,13 @@ void QWindowsWindow::checkForScreenChanged(ScreenChangeMode mode)
if (newScreen == nullptr || newScreen == currentScreen)
return;
// For screens with different DPI: postpone until WM_DPICHANGE
- if (mode == FromGeometryChange
+ // Check on currentScreen as it can be 0 when resuming a session (QTBUG-80436).
+ if (mode == FromGeometryChange && currentScreen != nullptr
&& !equalDpi(currentScreen->logicalDpi(), newScreen->logicalDpi())) {
return;
}
qCDebug(lcQpaWindows).noquote().nospace() << __FUNCTION__
- << ' ' << window() << " \"" << currentScreen->name()
+ << ' ' << window() << " \"" << (currentScreen ? currentScreen->name() : QString())
<< "\"->\"" << newScreen->name() << '"';
if (mode == FromGeometryChange)
setFlag(SynchronousGeometryChangeEvent);
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 44d0bb3f55..e937464c62 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -41,7 +41,6 @@
#include "qxcbwindow.h"
#include "qxcbcursor.h"
#include "qxcbimage.h"
-#include "qxcbintegration.h"
#include "qnamespace.h"
#include "qxcbxsettings.h"
@@ -50,7 +49,6 @@
#include <QDebug>
#include <QtAlgorithms>
-#include <qpa/qplatformservices.h>
#include <qpa/qwindowsysteminterface.h>
#include <private/qmath_p.h>
#include <QtGui/private/qhighdpiscaling_p.h>
@@ -368,15 +366,6 @@ static QFontEngine::SubpixelAntialiasingType parseXftRgba(const QByteArray& stri
void QXcbVirtualDesktop::readXResources()
{
- const QPlatformServices *services = QXcbIntegration::instance()->services();
- bool useXftConf = false;
- if (services) {
- const QList<QByteArray> desktopEnv = services->desktopEnvironment().split(':');
- useXftConf = desktopEnv.contains("GNOME") || desktopEnv.contains("UNITY") || desktopEnv.contains("XFCE");
- }
- if (!useXftConf)
- return;
-
int offset = 0;
QByteArray resources;
while (true) {
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp
index d993518665..5ac22287e2 100644
--- a/src/tools/androiddeployqt/main.cpp
+++ b/src/tools/androiddeployqt/main.cpp
@@ -417,7 +417,7 @@ Options parseOptions()
options.buildAAB = true;
options.build = true;
options.jarSigner = true;
- } else if (options.buildAAB && argument.compare(QLatin1String("--no-build"), Qt::CaseInsensitive) == 0) {
+ } else if (!options.buildAAB && argument.compare(QLatin1String("--no-build"), Qt::CaseInsensitive) == 0) {
options.build = false;
} else if (argument.compare(QLatin1String("--install"), Qt::CaseInsensitive) == 0) {
options.installApk = true;