public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Sandro Mani <manisandro@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/mingw-qt5-qtbase] f45: Backport fix for CVE-2026-107157, CVE-2026-101201
Date: Sat, 31 Oct 2026 15:24:20 GMT	[thread overview]
Message-ID: <179346026041.1.2856126226532480952.rpms-mingw-qt5-qtbase-d3b78330a364@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/mingw-qt5-qtbase
Branch : f45
Commit : d3b78330a364cb9938a758c6f5e051a48a5a228f
Author : Sandro Mani <manisandro@gmail.com>
Date   : 2026-10-31T15:53:23+01:00
Stats  : +203/-1 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/mingw-qt5-qtbase/c/d3b78330a364cb9938a758c6f5e051a48a5a228f?branch=f45

Log:
Backport fix for CVE-2026-107157, CVE-2026-101201

---
diff --git a/CVE-2026-101201.patch b/CVE-2026-101201.patch
new file mode 100644
index 0000000..a270646
--- /dev/null
+++ b/CVE-2026-101201.patch
@@ -0,0 +1,173 @@
+diff -rupN --no-dereference qtbase-everywhere-src-5.15.18/src/corelib/serialization/qjsondocument.cpp qtbase-everywhere-src-5.15.18-new/src/corelib/serialization/qjsondocument.cpp
+--- qtbase-everywhere-src-5.15.18/src/corelib/serialization/qjsondocument.cpp	2025-06-05 16:07:26.000000000 +0200
++++ qtbase-everywhere-src-5.15.18-new/src/corelib/serialization/qjsondocument.cpp	2026-10-31 14:56:37.284463319 +0100
+@@ -347,7 +347,7 @@ const char *QJsonDocument::rawData(int *
+  */
+ QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidation validation)
+ {
+-    if (uint(data.size()) < sizeof(QBinaryJsonPrivate::Header) + sizeof(QBinaryJsonPrivate::Base))
++    if (size_t(data.size()) < sizeof(QBinaryJsonPrivate::Header) + sizeof(QBinaryJsonPrivate::Base))
+         return QJsonDocument();
+ 
+     QBinaryJsonPrivate::Header h;
+@@ -356,8 +356,13 @@ QJsonDocument QJsonDocument::fromBinaryD
+     memcpy(&root, data.constData() + sizeof(QBinaryJsonPrivate::Header),
+            sizeof(QBinaryJsonPrivate::Base));
+ 
+-    const uint size = sizeof(QBinaryJsonPrivate::Header) + root.size;
+-    if (h.tag != QJsonDocument::BinaryFormatTag || h.version != 1U || size > uint(data.size()))
++    uint headerSize = uint{sizeof(QBinaryJsonPrivate::Header)};
++    uint rootSize = uint{root.size};
++    if (rootSize > std::numeric_limits<uint>::max() - headerSize)
++        return QJsonDocument(); // not representable in Private::ConstData
++    uint size = headerSize + rootSize;
++
++    if (h.tag != QJsonDocument::BinaryFormatTag || h.version != 1U || size > size_t(data.size()))
+         return QJsonDocument();
+ 
+     std::unique_ptr<QBinaryJsonPrivate::ConstData> d
+diff -rupN --no-dereference qtbase-everywhere-src-5.15.18/tests/auto/corelib/serialization/json/tst_qtjson.cpp qtbase-everywhere-src-5.15.18-new/tests/auto/corelib/serialization/json/tst_qtjson.cpp
+--- qtbase-everywhere-src-5.15.18/tests/auto/corelib/serialization/json/tst_qtjson.cpp	2025-06-05 16:07:26.000000000 +0200
++++ qtbase-everywhere-src-5.15.18-new/tests/auto/corelib/serialization/json/tst_qtjson.cpp	2026-10-31 14:56:37.285066497 +0100
+@@ -28,6 +28,7 @@
+ 
+ #include <QtTest>
+ 
++#include <QtCore/qendian.h>
+ #include "qjsonarray.h"
+ #include "qjsonobject.h"
+ #include "qjsonvalue.h"
+@@ -124,6 +125,9 @@ private Q_SLOTS:
+     void testDebugStream();
+     void testCompactionError();
+ 
++    void binaryDataOutOfBoundsRead_data();
++    void binaryDataOutOfBoundsRead();
++
+     void parseUnicodeEscapes();
+ 
+     void assignObjects();
+@@ -3771,5 +3775,123 @@ void tst_QtJson::noLeakOnNameClash()
+     // In particular it should not forget to deref the container for the inner object.
+ }
+ 
++enum class CallType : quint8
++{
++    Binary,
++    Raw,
++};
++
++void tst_QtJson::binaryDataOutOfBoundsRead_data()
++{
++    QTest::addColumn<quint32>("corruptedSize");
++    QTest::addColumn<int>("corruptedTableOffset");
++    QTest::addColumn<CallType>("callType");
++
++    // The case with 0xFFFFFFF4 should be handled properly, because the
++    // calculation does not roundtrip
++    QTest::newRow("0xFFFFFFF4_128_binary") << 0xFFFFFFF4u << 128 << CallType::Binary;
++    QTest::newRow("0xFFFFFFF8_32_binary") << 0xFFFFFFF8u << 32 << CallType::Binary;
++    QTest::newRow("0xFFFFFFFC_512_binary") << 0xFFFFFFFCu << 512 << CallType::Binary;
++    QTest::newRow("0xFFFFFFFF_4088_binary") << 0xFFFFFFFFu<<  4088 << CallType::Binary;
++
++    QTest::newRow("0xFFFFFFF4_128_raw") << 0xFFFFFFF4u << 128 << CallType::Raw;
++    QTest::newRow("0xFFFFFFF8_32_raw") << 0xFFFFFFF8u << 32 << CallType::Raw;
++    QTest::newRow("0xFFFFFFFC_512_raw") << 0xFFFFFFFCu << 512 << CallType::Raw;
++    QTest::newRow("0xFFFFFFFF_4088_raw") << 0xFFFFFFFFu<<  4088 << CallType::Raw;
++}
++
++void tst_QtJson::binaryDataOutOfBoundsRead()
++{
++    QFETCH(const quint32, corruptedSize);
++    QFETCH(const int, corruptedTableOffset);
++    QFETCH(const CallType, callType);
++
++    // Two single element arrays whose value is small enough to be stored inline
++    // in the root's value table: Value packs a 27 bit signed int, and
++    // Value::isValid() accepts an inline int without checking any offset. Both
++    // therefore encode to Header(8) + Base(12) + one 4 byte Value = 24 bytes
++    // with no out-of-line data, so moving the table moves the value with it.
++    const QJsonDocument original = QJsonDocument::fromJson("[1]");
++    const QJsonDocument planted = QJsonDocument::fromJson("[424242]");
++    QVERIFY(!original.isNull());
++    QVERIFY(!planted.isNull());
++
++    const QByteArray originalBlob = QBinaryJson::toBinaryData(original);
++    const QByteArray plantedBlob = QBinaryJson::toBinaryData(planted);
++
++    const qsizetype originalBlobSize = originalBlob.size();
++
++    constexpr qsizetype HeaderSize = 8;   // Header { qle_uint tag; qle_uint version; }
++    constexpr qsizetype RootSizeOffset = HeaderSize;        // Base::size
++    constexpr qsizetype TableOffsetOffset = HeaderSize + 8; // Base::tableOffset
++
++    // A backing allocation much larger than the buffer the parser will be
++    // given. Everything past the first originalBlobSize bytes is memory that
++    // a correct parser must never touch; planting known bytes there is what
++    // makes the out-of-bounds read observable rather than merely undefined.
++    // Pointing tableOffset past a tightly sized allocation instead would be a
++    // genuine heap-buffer-overflow, but it would only be diagnosed under a
++    // sanitizer and would otherwise crash the test run.
++    QByteArray buffer(4096, '\0');
++    Q_ASSERT(corruptedTableOffset + qsizetype(sizeof(quint32)) <= buffer.size());
++    // Copy the original blob at the beginning
++    memcpy(buffer.data(), originalBlob.constData(), originalBlobSize);
++
++    // Copy the other document's 4 byte table entry out of bounds.
++    const quint32 plantedBlobTableOffset =
++            qFromLittleEndian<quint32>(plantedBlob.constData() + TableOffsetOffset);
++    memcpy(buffer.data() + corruptedTableOffset,
++           plantedBlob.constData() + HeaderSize + plantedBlobTableOffset,
++           sizeof(quint32));
++
++    // fromBinaryData() computes the document bound as
++    //     const uint size = sizeof(Header) + root.size;
++    // sizeof() is 64 bit while root.size is a 32 bit field taken straight from
++    // the input, so the sum is evaluated in 64 bits and then truncated on
++    // assignment to uint. Every root.size in [0xfffffff8, 0xffffffff] collapses
++    // to 0..7 and trivially passes the "size > uint(data.size())" check that is
++    // supposed to keep the root inside the buffer. ConstData::isValid() then
++    // recomputes maxSize as "alloc - sizeof(Header)", which underflows straight
++    // back to root.size, so the root ends up being validated against its own
++    // attacker-supplied length instead of against the real buffer.
++    //
++    // Once that happens nothing constrains tableOffset either: the guard
++    // "tableOffset + length() * sizeof(offset) > size" now compares against
++    // root.size instead of against the buffer, so both Array::isValid() and
++    // Array::toJsonArray() read the value table from 32 bytes past the end.
++
++    // Modify the size of the original blob
++    qToLittleEndian(corruptedSize, buffer.data() + RootSizeOffset);
++    // Modify the tableOffset to point to a newly-injected table
++    qToLittleEndian(quint32(corruptedTableOffset - HeaderSize),
++                    buffer.data() + TableOffsetOffset);
++
++    // Hand the parser a view over the first origianlBlobSize bytes only.
++    // That size is the only bound it is given, so anything it reads beyond it
++    // is out of bounds.
++    const QByteArray nonOwningArray =
++            QByteArray::fromRawData(buffer.constData(), originalBlobSize);
++    QCOMPARE(nonOwningArray.size(), originalBlobSize);
++
++    // The code below passes a correct size to fromRawData() call.
++    // Surely we could observe the same problem, if we passed corruptedSize
++    // instead, but that's a typical problem for all APIs that take a pointer
++    // and a size.
++    const QJsonDocument doc = (callType == CallType::Binary)
++            ? QBinaryJson::fromBinaryData(nonOwningArray)
++            : QBinaryJson::fromRawData(nonOwningArray.constData(), int(nonOwningArray.size()));
++    if (!doc.isNull()) {
++        QFAIL(qPrintable(QString::asprintf(
++                "fromBinaryData() was handed %lld bytes but read the root array's value "
++                "table from offset %lld: it returned %s, which was planted out of bounds, "
++                "instead of rejecting the document",
++                qlonglong(nonOwningArray.size()), qlonglong(corruptedTableOffset),
++                doc.toJson(QJsonDocument::Compact).simplified().constData())));
++    }
++
++    // Check that the original blob can still be parsed correctly
++    QCOMPARE(QBinaryJson::fromBinaryData(originalBlob), original);
++}
++
+ QTEST_MAIN(tst_QtJson)
+ #include "tst_qtjson.moc"

diff --git a/CVE-2026-107157.patch b/CVE-2026-107157.patch
new file mode 100644
index 0000000..7e3a130
--- /dev/null
+++ b/CVE-2026-107157.patch
@@ -0,0 +1,15 @@
+diff -rupN --no-dereference qtbase-everywhere-src-5.15.18/src/corelib/serialization/qcborvalue.h qtbase-everywhere-src-5.15.18-new/src/corelib/serialization/qcborvalue.h
+--- qtbase-everywhere-src-5.15.18/src/corelib/serialization/qcborvalue.h	2025-06-05 16:07:26.000000000 +0200
++++ qtbase-everywhere-src-5.15.18-new/src/corelib/serialization/qcborvalue.h	2026-10-31 14:56:36.194299126 +0100
+@@ -292,9 +292,9 @@ public:
+     static QCborValue fromCbor(QCborStreamReader &reader);
+     static QCborValue fromCbor(const QByteArray &ba, QCborParserError *error = nullptr);
+     static QCborValue fromCbor(const char *data, qsizetype len, QCborParserError *error = nullptr)
+-    { return fromCbor(QByteArray(data, int(len)), error); }
++    { return fromCbor(QByteArray(data, len), error); }
+     static QCborValue fromCbor(const quint8 *data, qsizetype len, QCborParserError *error = nullptr)
+-    { return fromCbor(QByteArray(reinterpret_cast<const char *>(data), int(len)), error); }
++    { return fromCbor(QByteArray(reinterpret_cast<const char *>(data), len), error); }
+ #endif // QT_CONFIG(cborstreamreader)
+ #if QT_CONFIG(cborstreamwriter)
+     QByteArray toCbor(EncodingOptions opt = NoTransformation);

diff --git a/mingw-qt5-qtbase.spec b/mingw-qt5-qtbase.spec
index ccbae98..5e88a9f 100644
--- a/mingw-qt5-qtbase.spec
+++ b/mingw-qt5-qtbase.spec
@@ -25,7 +25,7 @@
 
 Name:           mingw-qt5-qtbase
 Version:        5.15.18
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        Qt5 for Windows - QtBase component
 
 # See LGPL_EXCEPTIONS.txt, for exception details
@@ -104,11 +104,22 @@ Patch19:        qtbase-5.15.8-fix-missing-qtsan-include.patch
 Patch20:        qtbase-fix-linking-against-static-harfbuzz.patch
 
 # Backport fix for CVE-2026-19248
+# https://github.com/qt/qtbase/commit/1303f05b33bb777626644729dd3b1330f60ecb7f
 Patch21:        CVE-2026-19248.patch
 
 # Backport fix for CVE-2026-11573
+# https://github.com/qt/qtbase/commit/948599e7b71f59fd9c9c0f7f3d1987ec93a23490
 Patch22:        CVE-2026-11573.patch
 
+# Backport fix for CVE-2026-107157
+# https://github.com/qt/qtbase/commit/64f07e1ee05f22447a6bd1d74ec3293419c93c5d
+Patch23:        CVE-2026-107157.patch
+
+# Backport fix for CVE-2026-101201
+# https://github.com/qt/qt5compat/commit/721ed576391211ca53ecdaaecf6dd41df7bc962e
+# https://github.com/qt/qt5compat/commit/c0a495894d83a3c48055bd1e544f93147fc6ade1
+Patch24:        CVE-2026-101201.patch
+
 
 # https://invent.kde.org/qt/qt/qtbase, kde/5.15 branch
 # git diff v5.15.15-lts-lgpl..HEAD | gzip > kde-5.15-rollup-$(date +%Y%m%d).patch.gz
@@ -825,6 +836,9 @@ ln -s %{mingw64_target}-qmake-qt5 %{buildroot}%{_bindir}/mingw64-qmake-qt5
 
 
 %changelog
+* Sat Oct 31 2026 Sandro Mani <manisandro@gmail.com> - 5.15.18-5
+- Backport fix for CVE-2026-107157, CVE-2026-101201
+
 * Sun Oct 25 2026 Sandro Mani <manisandro@gmail.com> - 5.15.18-4
 - Backport fixes for CVE-2026-19248 and CVE-2026-11573
 

                 reply	other threads:[~2026-10-31 15:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179346026041.1.2856126226532480952.rpms-mingw-qt5-qtbase-d3b78330a364@fedoraproject.org \
    --to=manisandro@gmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox