Skip to content

Commit 5046964

Browse files
committed
depends: add patches included with Qt 5.15.19
1 parent 0286d78 commit 5046964

4 files changed

Lines changed: 243 additions & 0 deletions

File tree

depends/packages/qt.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ $(package)_patches += memory_resource.patch
2323
$(package)_patches += utc_from_string_no_optimize.patch
2424
$(package)_patches += windows_lto.patch
2525
$(package)_patches += darwin_no_libm.patch
26+
$(package)_patches += CVE-2025-4211-qtbase-5.15.patch
27+
$(package)_patches += CVE-2025-5455-qtbase-5.15.patch
28+
$(package)_patches += CVE-2025-30348-qtbase-5.15.patch
2629

2730
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
2831
$(package)_qttranslations_sha256_hash=e5625757913caf66a9d702ba102ae92cb165d8dde17759b6de9fdea84a1f857f
@@ -252,6 +255,9 @@ define $(package)_preprocess_cmds
252255
patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \
253256
patch -p1 -i $($(package)_patch_dir)/windows_lto.patch && \
254257
patch -p1 -i $($(package)_patch_dir)/darwin_no_libm.patch && \
258+
patch -p1 -i $($(package)_patch_dir)/CVE-2025-4211-qtbase-5.15.patch && \
259+
patch -p1 -i $($(package)_patch_dir)/CVE-2025-5455-qtbase-5.15.patch && \
260+
patch -p1 -i $($(package)_patch_dir)/CVE-2025-30348-qtbase-5.15.patch && \
255261
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
256262
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
257263
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
From 16918c1df3e709df2a97281e3825d94c84edb668 Mon Sep 17 00:00:00 2001
2+
From: Christian Ehrlicher <ch.ehrlicher@gmx.de>
3+
Date: Tue, 06 Aug 2024 22:39:44 +0200
4+
Subject: [PATCH] XML/QDom: speedup encodeText()
5+
6+
The code copied the whole string, then replaced parts inline, at
7+
the cost of relocating everything beyond, at each replacement.
8+
Instead, copy character by character (in chunks where possible)
9+
and append replacements as we skip what they replace.
10+
11+
Manual conflict resolution for 6.5:
12+
- This is a manual cherry-pick. The original change was only
13+
picked to 6.8, but the quadratic behavior is present in Qt 5, too.
14+
- Changed Task-number to Fixes: because this is the real fix;
15+
the QString change, 315210de916d060c044c01e53ff249d676122b1b,
16+
was unrelated to the original QTBUG-127549.
17+
18+
Manual conflcit resolution for 5.15:
19+
- Kept/re-added QTextCodec::canEncode() check
20+
- Ported from Qt 6 to 5, to wit:
21+
- qsizetype -> int
22+
- QStringView::first/sliced(n) -> left/mid(n)
23+
(these functions are clearly called in-range, so the widened
24+
contract of the Qt 5 functions doesn't matter)
25+
- Ported from C++17- and C++14-isms to C++11:
26+
- replaced polymorphic lambda with a normal one (this requires
27+
rewriting the !canEncode() branch to use QByteArray/QLatin1String
28+
instead of QString)
29+
- As a drive-by, corrected the indentation of the case labels to
30+
horizontally align existing code (and follow Qt style)
31+
32+
Fixes: QTBUG-127549
33+
Change-Id: I368482859ed0c4127f1eec2919183711b5488ada
34+
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
35+
(cherry picked from commit 2ce08e3671b8d18b0284447e5908ce15e6e8f80f)
36+
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
37+
(cherry picked from commit 225e235cf966a44af23dbe9aaaa2fd20ab6430ee)
38+
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
39+
(cherry picked from commit 905a5bd421efff6a1d90b6140500d134d32ca745)
40+
---
41+
42+
diff --git a/qtbase/src/xml/dom/qdom.cpp b/qtbase/src/xml/dom/qdom.cpp
43+
index 872221c..bf70477 100644
44+
--- a/qtbase/src/xml/dom/qdom.cpp
45+
+++ b/qtbase/src/xml/dom/qdom.cpp
46+
@@ -3676,59 +3676,67 @@
47+
const QTextCodec *const codec = s.codec();
48+
Q_ASSERT(codec);
49+
#endif
50+
- QString retval(str);
51+
- int len = retval.length();
52+
- int i = 0;
53+
+ QString retval;
54+
+ int start = 0;
55+
+ auto appendToOutput = [&](int cur, QLatin1String replacement)
56+
+ {
57+
+ if (start < cur) {
58+
+ retval.reserve(str.size() + replacement.size());
59+
+ retval.append(QStringView(str).left(cur).mid(start));
60+
+ }
61+
+ // Skip over str[cur], replaced by replacement
62+
+ start = cur + 1;
63+
+ retval.append(replacement);
64+
+ };
65+
66+
- while (i < len) {
67+
- const QChar ati(retval.at(i));
68+
-
69+
- if (ati == QLatin1Char('<')) {
70+
- retval.replace(i, 1, QLatin1String("&lt;"));
71+
- len += 3;
72+
- i += 4;
73+
- } else if (encodeQuotes && (ati == QLatin1Char('"'))) {
74+
- retval.replace(i, 1, QLatin1String("&quot;"));
75+
- len += 5;
76+
- i += 6;
77+
- } else if (ati == QLatin1Char('&')) {
78+
- retval.replace(i, 1, QLatin1String("&amp;"));
79+
- len += 4;
80+
- i += 5;
81+
- } else if (ati == QLatin1Char('>') && i >= 2 && retval[i - 1] == QLatin1Char(']') && retval[i - 2] == QLatin1Char(']')) {
82+
- retval.replace(i, 1, QLatin1String("&gt;"));
83+
- len += 3;
84+
- i += 4;
85+
- } else if (performAVN &&
86+
- (ati == QChar(0xA) ||
87+
- ati == QChar(0xD) ||
88+
- ati == QChar(0x9))) {
89+
- const QString replacement(QLatin1String("&#x") + QString::number(ati.unicode(), 16) + QLatin1Char(';'));
90+
- retval.replace(i, 1, replacement);
91+
- i += replacement.length();
92+
- len += replacement.length() - 1;
93+
- } else if (encodeEOLs && ati == QChar(0xD)) {
94+
- retval.replace(i, 1, QLatin1String("&#xd;")); // Replace a single 0xD with a ref for 0xD
95+
- len += 4;
96+
- i += 5;
97+
- } else {
98+
+ const int len = str.size();
99+
+ for (int cur = 0; cur < len; ++cur) {
100+
+ switch (const char16_t ati = str[cur].unicode()) {
101+
+ case u'<':
102+
+ appendToOutput(cur, QLatin1String("&lt;"));
103+
+ break;
104+
+ case u'"':
105+
+ if (encodeQuotes)
106+
+ appendToOutput(cur, QLatin1String("&quot;"));
107+
+ break;
108+
+ case u'&':
109+
+ appendToOutput(cur, QLatin1String("&amp;"));
110+
+ break;
111+
+ case u'>':
112+
+ if (cur >= 2 && str[cur - 1] == u']' && str[cur - 2] == u']')
113+
+ appendToOutput(cur, QLatin1String("&gt;"));
114+
+ break;
115+
+ case u'\r':
116+
+ if (performAVN || encodeEOLs)
117+
+ appendToOutput(cur, QLatin1String("&#xd;")); // \r == 0x0d
118+
+ break;
119+
+ case u'\n':
120+
+ if (performAVN)
121+
+ appendToOutput(cur, QLatin1String("&#xa;")); // \n == 0x0a
122+
+ break;
123+
+ case u'\t':
124+
+ if (performAVN)
125+
+ appendToOutput(cur, QLatin1String("&#x9;")); // \t == 0x09
126+
+ break;
127+
+ default:
128+
#if QT_CONFIG(textcodec)
129+
if(codec->canEncode(ati))
130+
- ++i;
131+
+ ; // continue
132+
else
133+
#endif
134+
{
135+
// We have to use a character reference to get it through.
136+
- const ushort codepoint(ati.unicode());
137+
- const QString replacement(QLatin1String("&#x") + QString::number(codepoint, 16) + QLatin1Char(';'));
138+
- retval.replace(i, 1, replacement);
139+
- i += replacement.length();
140+
- len += replacement.length() - 1;
141+
+ const QByteArray replacement = "&#x" + QByteArray::number(uint{ati}, 16) + ';';
142+
+ appendToOutput(cur, QLatin1String{replacement});
143+
}
144+
+ break;
145+
}
146+
}
147+
-
148+
- return retval;
149+
+ if (start > 0) {
150+
+ retval.append(QStringView(str).left(len).mid(start));
151+
+ return retval;
152+
+ }
153+
+ return str;
154+
}
155+
156+
void QDomAttrPrivate::save(QTextStream& s, int, int) const
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
From 3d20cd0105c2ae06605c5078e7675e200f1a001a Mon Sep 17 00:00:00 2001
2+
From: Mårten Nordheim <marten.nordheim@qt.io>
3+
Date: Mon, 17 Mar 2025 14:22:11 +0100
4+
Subject: [PATCH] QFileSystemEngine/Win: Use GetTempPath2 when available
5+
6+
Because the documentation for GetTempPath nows says apps should call
7+
GetTempPath2.[0]
8+
9+
Starting with Windows 11[1], and recently Windows 10[2],
10+
GetTempPath2 was added. The difference being that elevated
11+
processes are returned a different directory. Usually
12+
'C:\Windows\SystemTemp'.
13+
14+
Currently temporary files of an elevated process may be placed in a
15+
world write-able location. GetTempPath2, by default, but can be
16+
overridden, places it in a directory that's only accessible by SYSTEM
17+
and administrators.
18+
19+
[0] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppathw#remarks
20+
[1] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2w
21+
(Minimum supported client - Windows 11 Build 22000)
22+
[2] https://blogs.windows.com/windows-insider/2025/03/13/releasing-windows-10-build-19045-5674-to-the-release-preview-channel/
23+
(This update enables system processes to store temporary files ...)
24+
25+
[ChangeLog][QtCore][Important Behavior Changes] On
26+
Windows, generating temporary directories for processes with elevated
27+
privileges may now return a different path with a stricter
28+
set of permissions. Please consult Microsoft's documentation from when
29+
they made the same change for the .NET framework:
30+
https://support.microsoft.com/en-us/topic/gettemppath-changes-in-windows-february-cumulative-update-preview-4cc631fb-9d97-4118-ab6d-f643cd0a7259
31+
32+
Change-Id: I5caf11151fb2f711bbc5599231f140598b3c9d03
33+
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
34+
(cherry picked from commit 69633bcb58e681bac5bff3744e5a2352788dc36c)
35+
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
36+
(cherry picked from commit 6a684a53b371ec483b27bf243af24819be63f85f)
37+
(cherry picked from commit bbeccc0c22e520f46f0b33e281fa5ac85ac9c727)
38+
(cherry picked from commit 59d7eb9bbb4f13cccbd9323fd995a8c108b56e60)
39+
---
40+
41+
diff --git a/qtbase/src/corelib/io/qfilesystemengine_win.cpp b/qtbase/src/corelib/io/qfilesystemengine_win.cpp
42+
index 75c661f..37a400f 100644
43+
--- a/qtbase/src/corelib/io/qfilesystemengine_win.cpp
44+
+++ b/qtbase/src/corelib/io/qfilesystemengine_win.cpp
45+
@@ -1390,7 +1390,15 @@
46+
QString ret;
47+
#ifndef Q_OS_WINRT
48+
wchar_t tempPath[MAX_PATH];
49+
- const DWORD len = GetTempPath(MAX_PATH, tempPath);
50+
+ using GetTempPathPrototype = DWORD (WINAPI *)(DWORD, LPWSTR);
51+
+ // We try to resolve GetTempPath2 and use that, otherwise fall back to GetTempPath:
52+
+ static GetTempPathPrototype getTempPathW = []() {
53+
+ const HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
54+
+ if (auto *func = QFunctionPointer(GetProcAddress(kernel32, "GetTempPath2W")))
55+
+ return GetTempPathPrototype(func);
56+
+ return GetTempPath;
57+
+ }();
58+
+ const DWORD len = getTempPathW(MAX_PATH, tempPath);
59+
if (len) { // GetTempPath() can return short names, expand.
60+
wchar_t longTempPath[MAX_PATH];
61+
const DWORD longLen = GetLongPathName(tempPath, longTempPath, MAX_PATH);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/qtbase/src/corelib/io/qdataurl.cpp b/qtbase/src/corelib/io/qdataurl.cpp
2+
index f14d399301f..83e59e3ac00 100644
3+
--- a/qtbase/src/corelib/io/qdataurl.cpp
4+
+++ b/qtbase/src/corelib/io/qdataurl.cpp
5+
@@ -76,10 +76,11 @@ Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &uri, QString &mimeType, QByteArray
6+
}
7+
8+
if (data.toLower().startsWith("charset")) {
9+
- int i = 7; // strlen("charset")
10+
- while (data.at(i) == ' ')
11+
- ++i;
12+
- if (data.at(i) == '=')
13+
+ int prefixSize = 7; // strlen("charset")
14+
+ QLatin1String copy(data.constData() + prefixSize, data.size() - prefixSize);
15+
+ while (copy.startsWith(QLatin1String(" ")))
16+
+ copy = copy.mid(1);
17+
+ if (copy.startsWith(QLatin1String("=")))
18+
data.prepend("text/plain;");
19+
}
20+

0 commit comments

Comments
 (0)