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-qt6-qt5compat] f45: Backport fix for CVE-2026-101201
Date: Mon, 26 Oct 2026 21:47:32 GMT	[thread overview]
Message-ID: <179305125252.1.15637593632092584548.rpms-mingw-qt6-qt5compat-9c3a47925f25@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/mingw-qt6-qt5compat
Branch : f45
Commit : 9c3a47925f25da27fbc170c1992b1b5cfa9359d1
Author : Sandro Mani <manisandro@gmail.com>
Date   : 2026-10-26T22:47:22+01:00
Stats  : +179/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/mingw-qt6-qt5compat/c/9c3a47925f25da27fbc170c1992b1b5cfa9359d1?branch=f45

Log:
Backport fix for CVE-2026-101201

---
diff --git a/CVE-2026-101201.patch b/CVE-2026-101201.patch
new file mode 100644
index 0000000..54fde2a
--- /dev/null
+++ b/CVE-2026-101201.patch
@@ -0,0 +1,171 @@
+diff -rupN qt5compat-everywhere-src-6.11.2/src/core5/serialization/qbinaryjson.cpp qt5compat-everywhere-src-6.11.2-new/src/core5/serialization/qbinaryjson.cpp
+--- qt5compat-everywhere-src-6.11.2/src/core5/serialization/qbinaryjson.cpp	2026-08-12 03:34:03.000000000 +0200
++++ qt5compat-everywhere-src-6.11.2-new/src/core5/serialization/qbinaryjson.cpp	2026-10-26 22:45:29.010981524 +0100
+@@ -140,7 +140,7 @@ const char *toRawData(const QJsonDocumen
+ */
+ 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;
+@@ -149,8 +149,11 @@ QJsonDocument fromBinaryData(const QByte
+     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 size = 0;
++    if (qAddOverflow(uint{sizeof(QBinaryJsonPrivate::Header)}, uint{root.size}, &size))
++        return QJsonDocument(); // not representable in Private::ConstData
++
++    if (h.tag != QJsonDocument::BinaryFormatTag || h.version != 1U || size > size_t(data.size()))
+         return QJsonDocument();
+ 
+     std::unique_ptr<QBinaryJsonPrivate::ConstData> d
+diff -rupN qt5compat-everywhere-src-6.11.2/tests/auto/core5/serialization/json/tst_qtjson.cpp qt5compat-everywhere-src-6.11.2-new/tests/auto/core5/serialization/json/tst_qtjson.cpp
+--- qt5compat-everywhere-src-6.11.2/tests/auto/core5/serialization/json/tst_qtjson.cpp	2026-08-12 03:34:03.000000000 +0200
++++ qt5compat-everywhere-src-6.11.2-new/tests/auto/core5/serialization/json/tst_qtjson.cpp	2026-10-26 22:45:29.011443547 +0100
+@@ -5,6 +5,7 @@
+ 
+ #include "qbinaryjson.h"
+ 
++#include <QtCore/qendian.h>
+ #include "qjsonarray.h"
+ #include "qjsonobject.h"
+ #include "qjsonvalue.h"
+@@ -31,6 +32,9 @@ private Q_SLOTS:
+     void compactObject();
+     void validation();
+     void testCompactionError();
++
++    void binaryDataOutOfBoundsRead_data();
++    void binaryDataOutOfBoundsRead();
+ private:
+     QString testDataDir;
+ };
+@@ -263,5 +267,123 @@ void tst_QtJson::testCompactionError()
+     }
+ }
+ 
++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/mingw-qt6-qt5compat.spec b/mingw-qt6-qt5compat.spec
index 289659f..6dbe803 100644
--- a/mingw-qt6-qt5compat.spec
+++ b/mingw-qt6-qt5compat.spec
@@ -18,7 +18,7 @@
 
 Name:           mingw-qt6-%{qt_module}
 Version:        6.11.2
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Qt6 for Windows - Qt5Compat component
 
 License:        LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0
@@ -29,6 +29,10 @@ Source0:        https://github.com/qt/%{qt_module}/archive/%{commit}/%{qt_module
 %else
 Source0:        http://download.qt.io/%{?pre:development}%{?!pre:official}_releases/qt/%{release_version}/%{qt_version}%{?pre:-%pre}/submodules/%{qt_module}-everywhere-src-%{qt_version}%{?pre:-%pre}.tar.xz
 %endif
+# Backport fix for CVE-2026-101201
+# https://github.com/qt/qt5compat/commit/c0a495894d83a3c48055bd1e544f93147fc6ade1
+# https://github.com/qt/qt5compat/commit/721ed576391211ca53ecdaaecf6dd41df7bc962e
+Patch0:         CVE-2026-101201.patch
 
 BuildArch:      noarch
 
@@ -136,6 +140,9 @@ export MINGW64_CXXFLAGS="%{mingw64_cflags} -msse2"
 
 
 %changelog
+* Mon Oct 26 2026 Sandro Mani <manisandro@gmail.com> - 6.11.2-2
+- Backport fix for CVE-2026-101201
+
 * Fri Aug 21 2026 Jan Grulich <jgrulich@redhat.com> - 6.11.2-1
 - 6.11.2
 

                 reply	other threads:[~2026-10-26 21:47 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=179305125252.1.15637593632092584548.rpms-mingw-qt6-qt5compat-9c3a47925f25@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