|
| 1 | +From 25c4ed587ff4b16ea682721ffad16031bb91f03e Mon Sep 17 00:00:00 2001 |
| 2 | +From: akhila-guruju < [email protected]> |
| 3 | +Date: Tue, 15 Jul 2025 06:19:38 +0000 |
| 4 | +Subject: [PATCH] Address CVE-2025-5455 |
| 5 | + |
| 6 | +Upstream patch reference: |
| 7 | + 1. https://download.qt.io/official_releases/qt/6.5/CVE-2025-5455-qtbase-6.5.patch |
| 8 | + 2. for test: https://codereview.qt-project.org/c/qt/qtbase/+/642006/7/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp |
| 9 | +--- |
| 10 | + src/corelib/io/qdataurl.cpp | 9 +++++---- |
| 11 | + tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp | 2 ++ |
| 12 | + 2 files changed, 7 insertions(+), 4 deletions(-) |
| 13 | + |
| 14 | +diff --git a/src/corelib/io/qdataurl.cpp b/src/corelib/io/qdataurl.cpp |
| 15 | +index 92c6f541..9ace4e1f 100644 |
| 16 | +--- a/src/corelib/io/qdataurl.cpp |
| 17 | ++++ b/src/corelib/io/qdataurl.cpp |
| 18 | +@@ -42,10 +42,11 @@ Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &uri, QString &mimeType, QByteArray |
| 19 | + } |
| 20 | + |
| 21 | + if (QLatin1StringView{data}.startsWith("charset"_L1, Qt::CaseInsensitive)) { |
| 22 | +- qsizetype i = 7; // strlen("charset") |
| 23 | +- while (data.at(i) == ' ') |
| 24 | +- ++i; |
| 25 | +- if (data.at(i) == '=') |
| 26 | ++ qsizetype prefixSize = 7; // strlen("charset") |
| 27 | ++ QByteArrayView copy(data.constData() + prefixSize, data.size() - prefixSize); |
| 28 | ++ while (copy.startsWith(' ')) |
| 29 | ++ copy = copy.sliced(1); |
| 30 | ++ if (copy.startsWith('=')) |
| 31 | + data.prepend("text/plain;"); |
| 32 | + } |
| 33 | + |
| 34 | +diff --git a/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp b/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp |
| 35 | +index 8cc1b0ae..c1db6d59 100644 |
| 36 | +--- a/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp |
| 37 | ++++ b/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp |
| 38 | +@@ -34,6 +34,8 @@ void tst_QDataUrl::decode_data() |
| 39 | + "text/plain"_L1, QByteArray::fromPercentEncoding("%E2%88%9A")); |
| 40 | + row("everythingIsCaseInsensitive", "Data:texT/PlaiN;charSet=iSo-8859-1;Base64,SGVsbG8=", true, |
| 41 | + "texT/PlaiN;charSet=iSo-8859-1"_L1, QByteArrayLiteral("Hello")); |
| 42 | ++ row("prematureCharsetEnd", "data:charset,", true, |
| 43 | ++ "charset", ""); // nonsense result, but don't crash |
| 44 | + } |
| 45 | + |
| 46 | + void tst_QDataUrl::decode() |
| 47 | +-- |
| 48 | +2.45.2 |
| 49 | + |
0 commit comments