[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#989469: marked as done (unblock: qtbase-opensource-src/5.15.2+dfsg-7)



Your message dated Sat, 05 Jun 2021 22:55:58 +0000
with message-id <E1lpfCw-00060j-3V@respighi.debian.org>
and subject line unblock qtbase-opensource-src
has caused the Debian Bug report #989469,
regarding unblock: qtbase-opensource-src/5.15.2+dfsg-7
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
989469: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=989469
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
X-Debbugs-Cc: debian-qt-kde@lists.debian.org

Please unblock package qtbase-opensource-src

[ Reason ]
This unblock request is for 3 things:

1) Make qtbase5-dev break qt5-default (see #976389, LP: #1920130). This affects
mostly people updating from an old testing installation.

2) A fix for QMimeDatabase behavior, which affects Plasma and KDE packages.

3) Fixes an invalid pointer return.


[ Impact ]

1) Without this fix people might get the gles variant installed in their normal systems.

2) Apps incorrectly identify some MIME types.

3) An invalid pointer is returned.

[ Tests ]

1) Yes, Dmitry Shachnev tested the upgrade path.

2)

$ kmimetypefinder5 /usr/share/squid-deb-proxy-client/apt-avahi-discover
text/x-python3

Which is now the expected behavior.

3) To be honest if apps where using this invalid pointer there would be plenty
of crashes already. Anyways I've uploaded qtbase and asked people to test it.
Running Plasma/KDE in itself is an excellent test as QGridLayout is a
tremendously used class and so far no one noticed anything wrong.

[ Risks ]

I sincerely don't think that any of them present a risk.

[ Checklist ]
  [X] all changes are documented in the d/changelog
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in testing

unblock qtbase-opensource-src/5.15.2+dfsg-7
diff -Nru qtbase-opensource-src-5.15.2+dfsg/debian/changelog qtbase-opensource-src-5.15.2+dfsg/debian/changelog
--- qtbase-opensource-src-5.15.2+dfsg/debian/changelog	2021-02-21 14:00:31.000000000 -0300
+++ qtbase-opensource-src-5.15.2+dfsg/debian/changelog	2021-06-03 09:55:29.000000000 -0300
@@ -1,3 +1,18 @@
+qtbase-opensource-src (5.15.2+dfsg-7) unstable; urgency=medium
+
+  [ Lu Yaning ]
+  * Backport upstream patch to fix invalid pointer return with
+    QGridLayout::itemAt(-1): fix-invalid-pointer-return-with-QGridLayout.diff
+
+ -- Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>  Thu, 03 Jun 2021 09:55:29 -0300
+
+qtbase-opensource-src (5.15.2+dfsg-6) unstable; urgency=medium
+
+  * Backport upstream patch to adjust QMimeDatabase behavior (LP: #1857824).
+  * Make qtbase5-dev break qt5-default (see #976389, LP: #1920130).
+
+ -- Dmitry Shachnev <mitya57@debian.org>  Sat, 29 May 2021 12:04:21 +0300
+
 qtbase-opensource-src (5.15.2+dfsg-5) unstable; urgency=medium
 
   * Backport upstream patch to fix allocated memory of QByteArray returned by
diff -Nru qtbase-opensource-src-5.15.2+dfsg/debian/control qtbase-opensource-src-5.15.2+dfsg/debian/control
--- qtbase-opensource-src-5.15.2+dfsg/debian/control	2021-02-21 14:00:31.000000000 -0300
+++ qtbase-opensource-src-5.15.2+dfsg/debian/control	2021-06-03 09:37:49.000000000 -0300
@@ -365,7 +365,8 @@
           libpq-dev,
           libsqlite3-dev,
           unixodbc-dev
-Breaks: qt5-qmake (<< 5.11.3+dfsg-3~),
+Breaks: qt5-default (<< 5.15.1+dfsg-2~),
+        qt5-qmake (<< 5.11.3+dfsg-3~),
         qtbase5-dev-tools (<< 5.12.5+dfsg-3~),
         qtbase5-private-dev (<< 5.11.3+dfsg-5~)
 Replaces: qt5-qmake (<< 5.11.3+dfsg-3~),
diff -Nru qtbase-opensource-src-5.15.2+dfsg/debian/patches/fix-invalid-pointer-return-with-QGridLayout.diff qtbase-opensource-src-5.15.2+dfsg/debian/patches/fix-invalid-pointer-return-with-QGridLayout.diff
--- qtbase-opensource-src-5.15.2+dfsg/debian/patches/fix-invalid-pointer-return-with-QGridLayout.diff	1969-12-31 21:00:00.000000000 -0300
+++ qtbase-opensource-src-5.15.2+dfsg/debian/patches/fix-invalid-pointer-return-with-QGridLayout.diff	2021-06-03 09:43:06.000000000 -0300
@@ -0,0 +1,113 @@
+From c47bb4478a4c3a29c0505d7d89755f40601b326f Mon Sep 17 00:00:00 2001
+From: Zhang Yu <zhangyub@uniontech.com>
+Date: Mon, 22 Feb 2021 09:25:01 +0800
+Subject: [PATCH] Fix invalid pointer return with QGridLayout::itemAt(-1)
+
+QGridLayout::takeAt() and QLayoutItem *itemAt() only check the upper bound.
+If the index < 0, these function will return invalid pointer.
+
+Fixes: QTBUG-91261
+Pick-to: 5.15 6.0 6.1
+Change-Id: Idfb9fb6228b9707f817353b04974da16205a835c
+Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+---
+
+diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp
+index 121bae0..336a68c 100644
+--- a/src/widgets/kernel/qgridlayout.cpp
++++ b/src/widgets/kernel/qgridlayout.cpp
+@@ -149,14 +149,14 @@
+     QRect cellRect(int row, int col) const;
+ 
+     inline QLayoutItem *itemAt(int index) const {
+-        if (index < things.count())
++        if (index >= 0 && index < things.count())
+             return things.at(index)->item();
+         else
+             return nullptr;
+     }
+     inline QLayoutItem *takeAt(int index) {
+         Q_Q(QGridLayout);
+-        if (index < things.count()) {
++        if (index >= 0 && index < things.count()) {
+             if (QGridBox *b = things.takeAt(index)) {
+                 QLayoutItem *item = b->takeItem();
+                 if (QLayout *l = item->layout()) {
+@@ -184,7 +184,7 @@
+     }
+ 
+     void getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) const {
+-        if (index < things.count()) {
++        if (index >= 0 && index < things.count()) {
+             const QGridBox *b =  things.at(index);
+             int toRow = b->toRow(rr);
+             int toCol = b->toCol(cc);
+diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+index e3bd1d1..2cf2462 100644
+--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
++++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+@@ -75,6 +75,7 @@
+     void taskQTBUG_40609_addingWidgetToItsOwnLayout();
+     void taskQTBUG_40609_addingLayoutToItself();
+     void taskQTBUG_52357_spacingWhenItemIsHidden();
++    void taskQTBUG_91261_itemIndexRange();
+     void replaceWidget();
+     void dontCrashWhenExtendsToEnd();
+ };
+@@ -1666,6 +1667,56 @@
+     QTRY_COMPARE_WITH_TIMEOUT(tempWidth, button1.width() + button3.width() + layout.spacing(), 1000);
+ }
+ 
++void tst_QGridLayout::taskQTBUG_91261_itemIndexRange()
++{
++    QWidget widget;
++    QGridLayout lay(&widget);
++    QPushButton *btn = new QPushButton(&widget);
++    lay.addWidget(btn, 0, 0);
++
++    {
++        auto ptr = lay.itemAt(-1);
++        QCOMPARE(ptr, nullptr);
++
++        ptr = lay.itemAt(0);
++        QCOMPARE(ptr->widget(), btn);
++
++        ptr = lay.itemAt(1);
++        QCOMPARE(ptr, nullptr);
++    }
++
++    {
++        int row = -1;
++        int column = -1;
++        int rowSpan;
++        int columnSpan;
++
++        lay.getItemPosition(-1, &row, &column, &rowSpan, &columnSpan);
++        QCOMPARE(row, -1);
++        QCOMPARE(column, -1);
++
++        lay.getItemPosition(1, &row, &column, &rowSpan, &columnSpan);
++        QCOMPARE(row, -1);
++        QCOMPARE(column, -1);
++
++        lay.getItemPosition(0, &row, &column, &rowSpan, &columnSpan);
++        QCOMPARE(row, 0);
++        QCOMPARE(column, 0);
++    }
++
++    {
++        auto ptr = lay.takeAt(-1);
++        QCOMPARE(ptr, nullptr);
++
++        ptr = lay.takeAt(1);
++        QCOMPARE(ptr, nullptr);
++
++        ptr = lay.takeAt(0);
++        QCOMPARE(ptr->widget(), btn);
++        delete ptr;
++    }
++}
++
+ void tst_QGridLayout::replaceWidget()
+ {
+     QWidget wdg;
diff -Nru qtbase-opensource-src-5.15.2+dfsg/debian/patches/mime_globs.diff qtbase-opensource-src-5.15.2+dfsg/debian/patches/mime_globs.diff
--- qtbase-opensource-src-5.15.2+dfsg/debian/patches/mime_globs.diff	1969-12-31 21:00:00.000000000 -0300
+++ qtbase-opensource-src-5.15.2+dfsg/debian/patches/mime_globs.diff	2021-06-03 09:37:49.000000000 -0300
@@ -0,0 +1,85 @@
+Description: adjust QMimeDatabase implementation
+ When multiple globs match, and the result from magic sniffing is
+ unrelated to any of those globs, globs have priority and one of them
+ should be picked up.
+ .
+ This change also optimizes QMimeBinaryProvider::addFileNameMatches
+ to have the same logic as xdgmime for glob matching:
+ literals > extensions > other globs
+ As soon as one category matches, we can stop there.
+ This makes no difference in the overall results, in practice.
+Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=0cbbba2aa5b47224
+Last-Update: 2021-05-18
+
+--- a/src/corelib/mimetypes/qmimedatabase.cpp
++++ b/src/corelib/mimetypes/qmimedatabase.cpp
+@@ -389,20 +389,23 @@ QMimeType QMimeDatabasePrivate::mimeType
+         // Disambiguate conflicting extensions (if magic matching found something)
+         if (candidateByData.isValid() && magicAccuracy > 0) {
+             const QString sniffedMime = candidateByData.name();
+-            // If the sniffedMime matches a glob match, use it
++            // If the sniffedMime matches a highest-weight glob match, use it
+             if (candidatesByName.m_matchingMimeTypes.contains(sniffedMime)) {
+                 *accuracyPtr = 100;
+                 return candidateByData;
+             }
+-            for (const QString &m : qAsConst(candidatesByName.m_matchingMimeTypes)) {
++            for (const QString &m : qAsConst(candidatesByName.m_allMatchingMimeTypes)) {
+                 if (inherits(m, sniffedMime)) {
+                     // We have magic + pattern pointing to this, so it's a pretty good match
+                     *accuracyPtr = 100;
+                     return mimeTypeForName(m);
+                 }
+             }
+-            *accuracyPtr = magicAccuracy;
+-            return candidateByData;
++            if (candidatesByName.m_allMatchingMimeTypes.isEmpty()) {
++                // No glob, use magic
++                *accuracyPtr = magicAccuracy;
++                return candidateByData;
++            }
+         }
+     }
+ 
+--- a/src/corelib/mimetypes/qmimeglobpattern.cpp
++++ b/src/corelib/mimetypes/qmimeglobpattern.cpp
+@@ -83,7 +83,10 @@ void QMimeGlobMatchResult::addMatch(cons
+     }
+     if (!m_matchingMimeTypes.contains(mimeType)) {
+         m_matchingMimeTypes.append(mimeType);
+-        m_allMatchingMimeTypes.append(mimeType);
++        if (replace)
++            m_allMatchingMimeTypes.prepend(mimeType); // highest-weight first
++        else
++            m_allMatchingMimeTypes.append(mimeType);
+         m_knownSuffixLength = knownSuffixLength;
+     }
+ }
+--- a/src/corelib/mimetypes/qmimeprovider.cpp
++++ b/src/corelib/mimetypes/qmimeprovider.cpp
+@@ -244,15 +244,18 @@ void QMimeBinaryProvider::addFileNameMat
+     const QString lowerFileName = fileName.toLower();
+     // Check literals (e.g. "Makefile")
+     matchGlobList(result, m_cacheFile, m_cacheFile->getUint32(PosLiteralListOffset), fileName);
+-    // Check complex globs (e.g. "callgrind.out[0-9]*")
+-    matchGlobList(result, m_cacheFile, m_cacheFile->getUint32(PosGlobListOffset), fileName);
+     // Check the very common *.txt cases with the suffix tree
+-    const int reverseSuffixTreeOffset = m_cacheFile->getUint32(PosReverseSuffixTreeOffset);
+-    const int numRoots = m_cacheFile->getUint32(reverseSuffixTreeOffset);
+-    const int firstRootOffset = m_cacheFile->getUint32(reverseSuffixTreeOffset + 4);
+-    matchSuffixTree(result, m_cacheFile, numRoots, firstRootOffset, lowerFileName, lowerFileName.length() - 1, false);
++    if (result.m_matchingMimeTypes.isEmpty()) {
++        const int reverseSuffixTreeOffset = m_cacheFile->getUint32(PosReverseSuffixTreeOffset);
++        const int numRoots = m_cacheFile->getUint32(reverseSuffixTreeOffset);
++        const int firstRootOffset = m_cacheFile->getUint32(reverseSuffixTreeOffset + 4);
++        matchSuffixTree(result, m_cacheFile, numRoots, firstRootOffset, lowerFileName, lowerFileName.length() - 1, false);
++        if (result.m_matchingMimeTypes.isEmpty())
++            matchSuffixTree(result, m_cacheFile, numRoots, firstRootOffset, fileName, fileName.length() - 1, true);
++    }
++    // Check complex globs (e.g. "callgrind.out[0-9]*" or "README*")
+     if (result.m_matchingMimeTypes.isEmpty())
+-        matchSuffixTree(result, m_cacheFile, numRoots, firstRootOffset, fileName, fileName.length() - 1, true);
++        matchGlobList(result, m_cacheFile, m_cacheFile->getUint32(PosGlobListOffset), fileName);
+ }
+ 
+ void QMimeBinaryProvider::matchGlobList(QMimeGlobMatchResult &result, CacheFile *cacheFile, int off, const QString &fileName)
diff -Nru qtbase-opensource-src-5.15.2+dfsg/debian/patches/series qtbase-opensource-src-5.15.2+dfsg/debian/patches/series
--- qtbase-opensource-src-5.15.2+dfsg/debian/patches/series	2021-02-21 14:00:31.000000000 -0300
+++ qtbase-opensource-src-5.15.2+dfsg/debian/patches/series	2021-06-03 09:54:58.000000000 -0300
@@ -3,6 +3,8 @@
 qnam_connect_memory_leak.diff
 gcc_11_limits.diff
 qiodevice_readline_memory.diff
+mime_globs.diff
+fix-invalid-pointer-return-with-QGridLayout.diff
 
 # Debian specific.
 gnukfreebsd.diff

--- End Message ---
--- Begin Message ---
Unblocked.

--- End Message ---

Reply to: