Merge remote-tracking branch 'origin/5.14' into 5.15

Change-Id: I5d80d84d1fd9f52e7c8e4895cc34d4d29043f400
This commit is contained in:
Qt Forward Merge Bot 2020-02-08 01:00:08 +01:00
commit 9634055543
15 changed files with 9080 additions and 5750 deletions

View File

@ -1,26 +0,0 @@
From 676425e522e08eb0e7dfaacdac79a5de27542322 Mon Sep 17 00:00:00 2001
From: Andy Shaw <andy.shaw@qt.io>
Date: Wed, 11 Dec 2019 10:51:22 +0100
Subject: [PATCH 53/53] Fix CVE-2019-19244 in SQLite
Fixes: QTBUG-80635
Change-Id: I718349e28ec76ea164dd50f2a985f2074dd6bdbd
---
src/3rdparty/sqlite/sqlite3.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index 8fd740b300..bd647ca1c2 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -131679,6 +131679,7 @@ SQLITE_PRIVATE int sqlite3Select(
*/
if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct
&& sqlite3ExprListCompare(sSort.pOrderBy, pEList, -1)==0
+ && p->pWin==0
){
p->selFlags &= ~SF_Distinct;
pGroupBy = p->pGroupBy = sqlite3ExprListDup(db, pEList, 0);
--
2.21.0 (Apple Git-122.2)

View File

@ -1,31 +0,0 @@
From 7905740b8e79479298e83d8e559fc49b46cf980e Mon Sep 17 00:00:00 2001
From: Andy Shaw <andy.shaw@qt.io>
Date: Thu, 19 Dec 2019 21:59:09 +0100
Subject: [PATCH] Fix CVE-2019-19242 in SQLite
Change-Id: I78a72a574da5cf3503950afe47146ae6424f00c6
---
src/3rdparty/sqlite/sqlite3.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index bd647ca1c2..d3e0c065b6 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -101055,7 +101055,12 @@ expr_code_doover:
** constant.
*/
int iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target);
- int aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
+ int aff;
+ if( pExpr->y.pTab ){
+ aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
+ }else{
+ aff = pExpr->affExpr;
+ }
if( aff>SQLITE_AFF_BLOB ){
static const char zAff[] = "B\000C\000D\000E";
assert( SQLITE_AFF_BLOB=='A' );
--
2.21.0 (Apple Git-122.2)

View File

@ -1,95 +0,0 @@
From 11a2f4647b67494fb731a6fd793f1b28074631d3 Mon Sep 17 00:00:00 2001
From: Andy Shaw <andy.shaw@qt.io>
Date: Thu, 19 Dec 2019 22:31:15 +0100
Subject: [PATCH] Fix CVE-2019-19603 in SQLite
This includes the patch needed to fix this CVE and a supporting one to
include a new function added that it depends on.
Task-number: QTBUG-80903
Change-Id: Ic7639d50c89a3ee7d45426588c3ab0efd0eebb72
---
src/3rdparty/sqlite/sqlite3.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index d3e0c065b6..a430554db7 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -19519,6 +19519,12 @@ SQLITE_PRIVATE Module *sqlite3VtabCreateModule(
);
# define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)
#endif
+SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db);
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName);
+#else
+# define sqlite3ShadowTableName(A,B) 0
+#endif
SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*);
SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*);
SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*);
@@ -108483,6 +108489,22 @@ SQLITE_PRIVATE int sqlite3WritableSchema(sqlite3 *db){
return (db->flags&(SQLITE_WriteSchema|SQLITE_Defensive))==SQLITE_WriteSchema;
}
+/*
+ ** Return TRUE if shadow tables should be read-only in the current
+ ** context.
+ */
+int sqlite3ReadOnlyShadowTables(sqlite3 *db){
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ if( (db->flags & SQLITE_Defensive)!=0
+ && db->pVtabCtx==0
+ && db->nVdbeExec==0
+ ){
+ return 1;
+ }
+#endif
+ return 0;
+}
+
/*
** This routine is used to check if the UTF-8 string zName is a legal
** unqualified name for a new schema object (table, index, view or
@@ -108516,8 +108538,8 @@ SQLITE_PRIVATE int sqlite3CheckObjectName(
}
}
}else{
- if( pParse->nested==0
- && 0==sqlite3StrNICmp(zName, "sqlite_", 7)
+ if( (pParse->nested==0 && 0==sqlite3StrNICmp(zName, "sqlite_", 7))
+ || (sqlite3ReadOnlyShadowTables(db) && sqlite3ShadowTableName(db, zName))
){
sqlite3ErrorMsg(pParse, "object name reserved for internal use: %s",
zName);
@@ -109662,7 +109684,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
** zName is temporarily modified while this routine is running, but is
** restored to its original value prior to this routine returning.
*/
-static int isShadowTableName(sqlite3 *db, char *zName){
+int sqlite3ShadowTableName(sqlite3 *db, const char *zName){
char *zTail; /* Pointer to the last "_" in zName */
Table *pTab; /* Table that zName is a shadow of */
Module *pMod; /* Module for the virtual table */
@@ -109680,8 +109702,6 @@ static int isShadowTableName(sqlite3 *db, char *zName){
if( pMod->pModule->xShadowName==0 ) return 0;
return pMod->pModule->xShadowName(zTail+1);
}
-#else
-# define isShadowTableName(x,y) 0
#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
/*
@@ -109723,7 +109743,7 @@ SQLITE_PRIVATE void sqlite3EndTable(
p = pParse->pNewTable;
if( p==0 ) return;
- if( pSelect==0 && isShadowTableName(db, p->zName) ){
+ if( pSelect==0 && sqlite3ShadowTableName(db, p->zName) ){
p->tabFlags |= TF_Shadow;
}
--
2.21.0 (Apple Git-122.2)

View File

@ -1,29 +0,0 @@
From a83bbce4d6f31d93ea4d2a681aa52c148f148e26 Mon Sep 17 00:00:00 2001
From: Andy Shaw <andy.shaw@qt.io>
Date: Thu, 2 Jan 2020 09:07:08 +0100
Subject: [PATCH] Fix CVE-2019-19646 in SQLite
Task-number: QTBUG-81020
Change-Id: I7176db20d4a44b1fb443a6108675f719e9643343
---
src/3rdparty/sqlite/sqlite3.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index 57e61b8313..980a149b1a 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -123765,7 +123765,9 @@ SQLITE_PRIVATE void sqlite3Pragma(
if( j==pTab->iPKey ) continue;
if( pTab->aCol[j].notNull==0 ) continue;
sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);
- sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
+ if( sqlite3VdbeGetOp(v,-1)->opcode==OP_Column ){
+ sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
+ }
jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v);
zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
pTab->aCol[j].zName);
--
2.21.0 (Apple Git-122.2)

View File

@ -1,83 +0,0 @@
From 78c972eec5bab03a408b8ba1373572bcfe2db630 Mon Sep 17 00:00:00 2001
From: Andy Shaw <andy.shaw@qt.io>
Date: Thu, 2 Jan 2020 08:47:23 +0100
Subject: [PATCH] Fix CVE-2019-19645 in SQLite
Task-number: QTBUG-81020
Change-Id: I58b1dd9e7a90ba998c3af7f25a4627d8bdd70970
---
src/3rdparty/sqlite/sqlite3.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index d3e0c065b6..57e61b8313 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -17946,6 +17946,7 @@ struct Select {
#define SF_IncludeHidden 0x20000 /* Include hidden columns in output */
#define SF_ComplexResult 0x40000 /* Result contains subquery or function */
#define SF_WhereBegin 0x80000 /* Really a WhereBegin() call. Debug Only */
+#define SF_View 0x0200000 /* SELECT statement is a view */
/*
** The results of a SELECT can be distributed in several ways, as defined
@@ -103920,6 +103921,7 @@ static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){
static int renameUnmapSelectCb(Walker *pWalker, Select *p){
Parse *pParse = pWalker->pParse;
int i;
+ if( p->selFlags & SF_View ) return WRC_Prune;
if( ALWAYS(p->pEList) ){
ExprList *pList = p->pEList;
for(i=0; i<pList->nExpr; i++){
@@ -104024,6 +104026,7 @@ static void renameWalkWith(Walker *pWalker, Select *pSelect){
** descend into sub-select statements.
*/
static int renameColumnSelectCb(Walker *pWalker, Select *p){
+ if( p->selFlags & SF_View ) return WRC_Prune;
renameWalkWith(pWalker, p);
return WRC_Continue;
}
@@ -104489,8 +104492,9 @@ static void renameColumnFunc(
if( sParse.pNewTable ){
Select *pSelect = sParse.pNewTable->pSelect;
if( pSelect ){
+ pSelect->selFlags &= ~SF_View;
sParse.rc = SQLITE_OK;
- sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, 0);
+ sqlite3SelectPrep(&sParse, pSelect, 0);
rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc);
if( rc==SQLITE_OK ){
sqlite3WalkSelect(&sWalker, pSelect);
@@ -104602,6 +104606,7 @@ static int renameTableSelectCb(Walker *pWalker, Select *pSelect){
int i;
RenameCtx *p = pWalker->u.pRename;
SrcList *pSrc = pSelect->pSrc;
+ if( pSelect->selFlags & SF_View ) return WRC_Prune;
if( pSrc==0 ){
assert( pWalker->pParse->db->mallocFailed );
return WRC_Abort;
@@ -104681,10 +104686,13 @@ static void renameTableFunc(
if( pTab->pSelect ){
if( isLegacy==0 ){
+ Select *pSelect = pTab->pSelect;
NameContext sNC;
memset(&sNC, 0, sizeof(sNC));
sNC.pParse = &sParse;
+ assert( pSelect->selFlags & SF_View );
+ pSelect->selFlags &= ~SF_View;
sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC);
if( sParse.nErr ) rc = sParse.rc;
sqlite3WalkSelect(&sWalker, pTab->pSelect);
@@ -109994,6 +110002,7 @@ SQLITE_PRIVATE void sqlite3CreateView(
** allocated rather than point to the input string - which means that
** they will persist after the current sqlite3_exec() call returns.
*/
+ pSelect->selFlags |= SF_View;
if( IN_RENAME_OBJECT ){
p->pSelect = pSelect;
pSelect = 0;
--
2.21.0 (Apple Git-122.2)

View File

@ -1,30 +0,0 @@
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)

View File

@ -6,8 +6,8 @@
"Description": "SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.", "Description": "SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.",
"Homepage": "https://www.sqlite.org/", "Homepage": "https://www.sqlite.org/",
"Version": "3.30.1", "Version": "3.31.1",
"DownloadLocation": "https://www.sqlite.org/2019/sqlite-amalgamation-3300100.zip", "DownloadLocation": "https://www.sqlite.org/2020/sqlite-amalgamation-3310100.zip",
"License": "Public Domain", "License": "Public Domain",
"Copyright": "The authors disclaim copyright to the source code. However, a license can be obtained if needed." "Copyright": "The authors disclaim copyright to the source code. However, a license can be obtained if needed."
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -108,6 +108,9 @@ void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data)
It is good practice to check that persistent model indexes are valid It is good practice to check that persistent model indexes are valid
before using them. before using them.
\note You cannot store a QStandardItemModel's QPersistentModelIndex
in one of the model's items.
\sa {Model/View Programming}, QModelIndex, QAbstractItemModel \sa {Model/View Programming}, QModelIndex, QAbstractItemModel
*/ */

View File

@ -39,11 +39,11 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static const char *standardImports = static const char *standardImports =
R"I(from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint, R"I(from PySide2.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject,
QRect, QSize, QUrl, Qt) QObject, QPoint, QRect, QSize, QTime, QUrl, Qt)
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap, QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter,
QRadialGradient) QPixmap, QRadialGradient)
from PySide2.QtWidgets import * from PySide2.QtWidgets import *
)I"; )I";

View File

@ -1350,6 +1350,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
QRect ir = btn->rect; QRect ir = btn->rect;
QStyleOptionButton newBtn = *btn; QStyleOptionButton newBtn = *btn;
newBtn.rect = QRect(ir.right() - mbi + 2, ir.height()/2 - mbi/2 + 3, mbi - 6, mbi - 6); newBtn.rect = QRect(ir.right() - mbi + 2, ir.height()/2 - mbi/2 + 3, mbi - 6, mbi - 6);
newBtn.rect = visualRect(btn->direction, br, newBtn.rect);
proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
} }
} }
@ -1378,7 +1379,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
int iconSpacing = 4;//### 4 is currently hardcoded in QPushButton::sizeHint() int iconSpacing = 4;//### 4 is currently hardcoded in QPushButton::sizeHint()
if (!button->text.isEmpty()) { if (!button->text.isEmpty()) {
int textWidth = button->fontMetrics.boundingRect(opt->rect, tf, button->text).width(); int textWidth = button->fontMetrics.boundingRect(opt->rect, tf, button->text).width();
labelWidth += (textWidth + iconSpacing); labelWidth += (textWidth + iconSpacing * 2);
} }
QRect iconRect = QRect(textRect.x() + (textRect.width() - labelWidth) / 2, QRect iconRect = QRect(textRect.x() + (textRect.width() - labelWidth) / 2,

View File

@ -3128,12 +3128,14 @@ void QComboBox::changeEvent(QEvent *e)
d->updateViewContainerPaletteAndOpacity(); d->updateViewContainerPaletteAndOpacity();
break; break;
} }
case QEvent::FontChange: case QEvent::FontChange: {
d->sizeHint = QSize(); // invalidate size hint d->sizeHint = QSize(); // invalidate size hint
d->viewContainer()->setFont(font()); d->viewContainer()->setFont(font());
d->viewContainer()->itemView()->doItemsLayout();
if (d->lineEdit) if (d->lineEdit)
d->updateLineEditGeometry(); d->updateLineEditGeometry();
break; break;
}
default: default:
break; break;
} }

View File

@ -36,11 +36,11 @@
## WARNING! All changes made in this file will be lost when recompiling UI file! ## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################ ################################################################################
from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint, from PySide2.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject,
QRect, QSize, QUrl, Qt) QObject, QPoint, QRect, QSize, QTime, QUrl, Qt)
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap, QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter,
QRadialGradient) QPixmap, QRadialGradient)
from PySide2.QtWidgets import * from PySide2.QtWidgets import *
from gammaview import GammaView from gammaview import GammaView

View File

@ -47,6 +47,7 @@
#include <qtablewidget.h> #include <qtablewidget.h>
#include <qscrollbar.h> #include <qscrollbar.h>
#include <qboxlayout.h> #include <qboxlayout.h>
#include <qstackedwidget.h>
#include <qstandarditemmodel.h> #include <qstandarditemmodel.h>
#include <qstringlistmodel.h> #include <qstringlistmodel.h>
@ -164,6 +165,7 @@ private slots:
void task_QTBUG_56693_itemFontFromModel(); void task_QTBUG_56693_itemFontFromModel();
void inputMethodUpdate(); void inputMethodUpdate();
void task_QTBUG_52027_mapCompleterIndex(); void task_QTBUG_52027_mapCompleterIndex();
void checkMenuItemPosWhenStyleSheetIsSet();
private: private:
PlatformInputContext m_platformInputContext; PlatformInputContext m_platformInputContext;
@ -3515,5 +3517,46 @@ void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex()
QCOMPARE(arguments.at(0).toInt(), 1); QCOMPARE(arguments.at(0).toInt(), 1);
} }
void tst_QComboBox::checkMenuItemPosWhenStyleSheetIsSet()
{
QString newCss = "QComboBox {font-size: 18pt;}";
QString oldCss = qApp->styleSheet();
qApp->setStyleSheet(newCss);
QWidget topLevel;
QVBoxLayout *layout = new QVBoxLayout(&topLevel);
QStackedWidget *stack = new QStackedWidget(&topLevel);
layout->addWidget(stack);
QWidget *container = new QWidget(&topLevel);
QHBoxLayout *cLayout = new QHBoxLayout(container);
QComboBox *cBox = new QComboBox;
QStandardItemModel *model = new QStandardItemModel(cBox);
QStandardItem *item = new QStandardItem(QStringLiteral("Item1"));
model->appendRow(item);
item = new QStandardItem(QStringLiteral("Item2"));
model->appendRow(item);
item = new QStandardItem(QStringLiteral("Item3"));
model->appendRow(item);
item = new QStandardItem(QStringLiteral("Item4"));
model->appendRow(item);
cBox->setModel(model);
cLayout->addWidget(cBox);
stack->addWidget(container);
topLevel.show();
cBox->showPopup();
QTRY_VERIFY(cBox->view());
QTRY_VERIFY(cBox->view()->isVisible());
int menuHeight = cBox->view()->geometry().height();
QRect menuItemRect = cBox->view()->visualRect(model->indexFromItem(item));
QCOMPARE(menuHeight, menuItemRect.y() + menuItemRect.height());
qApp->setStyleSheet(oldCss);
}
QTEST_MAIN(tst_QComboBox) QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc" #include "tst_qcombobox.moc"