Skip to content

Commit 13c8e54

Browse files
authored
[Medium] patch qt5-qtbase for CVE-2025-30348 (#14007)
1 parent a559ed5 commit 13c8e54

File tree

2 files changed

+99
-15
lines changed

2 files changed

+99
-15
lines changed

SPECS/qt5-qtbase/CVE-2025-30348.patch

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
From ccf4cbf309f7d1da4df07e2239e5b674b9534bce Mon Sep 17 00:00:00 2001
2+
From: jykanase <[email protected]>
3+
Date: Fri, 13 Jun 2025 14:00:19 +0000
4+
Subject: [PATCH] CVE-2025-30348.patch
5+
6+
Upstream Patch Reference: https://codereview.qt-project.org/c/qt/qtbase/+/581442/1/src/xml/dom/qdom.cpp#3643
7+
---
8+
src/xml/dom/qdom.cpp | 60 ++++++++++++++------------------------------
9+
1 file changed, 19 insertions(+), 41 deletions(-)
10+
11+
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
12+
index dd6916f9..cb33b78c 100644
13+
--- a/src/xml/dom/qdom.cpp
14+
+++ b/src/xml/dom/qdom.cpp
15+
@@ -4159,56 +4159,34 @@ static QString encodeText(const QString &str,
16+
const QTextCodec *const codec = s.codec();
17+
Q_ASSERT(codec);
18+
#endif
19+
- QString retval(str);
20+
- int len = retval.length();
21+
- int i = 0;
22+
+ const qsizetype len = str.size();
23+
+ QString retval;
24+
+ retval.reserve(len * 1.2);
25+
+ qsizetype i = 0;
26+
27+
while (i < len) {
28+
- const QChar ati(retval.at(i));
29+
+ const QChar ati(str.at(i));
30+
31+
if (ati == QLatin1Char('<')) {
32+
- retval.replace(i, 1, QLatin1String("&lt;"));
33+
- len += 3;
34+
- i += 4;
35+
+ retval.append(QLatin1String("&lt;"));
36+
} else if (encodeQuotes && (ati == QLatin1Char('"'))) {
37+
- retval.replace(i, 1, QLatin1String("&quot;"));
38+
- len += 5;
39+
- i += 6;
40+
+ retval.append(QLatin1String("&quot;"));
41+
} else if (ati == QLatin1Char('&')) {
42+
- retval.replace(i, 1, QLatin1String("&amp;"));
43+
- len += 4;
44+
- i += 5;
45+
- } else if (ati == QLatin1Char('>') && i >= 2 && retval[i - 1] == QLatin1Char(']') && retval[i - 2] == QLatin1Char(']')) {
46+
- retval.replace(i, 1, QLatin1String("&gt;"));
47+
- len += 3;
48+
- i += 4;
49+
+ retval.append(QLatin1String("&amp;"));
50+
+ } else if (ati == QLatin1Char('>') && i >= 2 && str.at(i - 1) == QLatin1Char(']') && str.at(i - 2) == QLatin1Char(']')) {
51+
+ retval.append(QLatin1String("&gt;"));
52+
} else if (performAVN &&
53+
- (ati == QChar(0xA) ||
54+
- ati == QChar(0xD) ||
55+
- ati == QChar(0x9))) {
56+
+ (ati == QLatin1Char(0xA) ||
57+
+ ati == QLatin1Char(0xD) ||
58+
+ ati == QLatin1Char(0x9))) {
59+
const QString replacement(QLatin1String("&#x") + QString::number(ati.unicode(), 16) + QLatin1Char(';'));
60+
- retval.replace(i, 1, replacement);
61+
- i += replacement.length();
62+
- len += replacement.length() - 1;
63+
- } else if (encodeEOLs && ati == QChar(0xD)) {
64+
- retval.replace(i, 1, QLatin1String("&#xd;")); // Replace a single 0xD with a ref for 0xD
65+
- len += 4;
66+
- i += 5;
67+
+ retval.append(replacement);
68+
+ } else if (encodeEOLs && ati == QLatin1Char(0xD)) {
69+
+ retval.append(QLatin1String("&#xd;")); // Replace a single 0xD with a ref for 0xD
70+
} else {
71+
-#if QT_CONFIG(textcodec)
72+
- if(codec->canEncode(ati))
73+
- ++i;
74+
- else
75+
-#endif
76+
- {
77+
- // We have to use a character reference to get it through.
78+
- const ushort codepoint(ati.unicode());
79+
- const QString replacement(QLatin1String("&#x") + QString::number(codepoint, 16) + QLatin1Char(';'));
80+
- retval.replace(i, 1, replacement);
81+
- i += replacement.length();
82+
- len += replacement.length() - 1;
83+
- }
84+
- }
85+
+ retval.append(ati);
86+
+ }
87+
+ ++i;
88+
}
89+
90+
return retval;
91+
--
92+
2.45.2
93+

SPECS/qt5-qtbase/qt5-qtbase.spec

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
Name: qt5-qtbase
3434
Summary: Qt5 - QtBase components
3535
Version: 5.12.11
36-
Release: 15%{?dist}
36+
Release: 16%{?dist}
3737
# See LICENSE.GPL3-EXCEPT.txt, for exception details
3838
License: GFDL AND LGPLv3 AND GPLv2 AND GPLv3 with exceptions AND QT License Agreement 4.0
3939
Vendor: Microsoft Corporation
@@ -167,6 +167,7 @@ Patch93: CVE-2022-25255.patch
167167

168168
Patch94: CVE-2024-25580.patch
169169
Patch95: CVE-2023-34410.patch
170+
Patch96: CVE-2025-30348.patch
170171

171172
# Do not check any files in %%{_qt5_plugindir}/platformthemes/ for requires.
172173
# Those themes are there for platform integration. If the required libraries are
@@ -270,20 +271,7 @@ Qt5 libraries used for drawing widgets and OpenGL items.
270271
%patch68 -p1
271272

272273
%patch80 -p1 -b .use-wayland-on-gnome.patch
273-
%patch81 -p1
274-
%patch82 -p1
275-
%patch83 -p1
276-
%patch84 -p1
277-
%patch86 -p1
278-
%patch87 -p1
279-
%patch88 -p1
280-
%patch89 -p1
281-
%patch90 -p1
282-
%patch91 -p1
283-
%patch92 -p1
284-
%patch93 -p1
285-
%patch94 -p1
286-
%patch95 -p1
274+
%autopatch -p1 -m 81
287275

288276
## upstream patches
289277

@@ -789,6 +777,9 @@ fi
789777
%{_qt5_libdir}/cmake/Qt5Gui/Qt5Gui_QXdgDesktopPortalThemePlugin.cmake
790778

791779
%changelog
780+
* Fri Jun 13 2025 Jyoti Kanase <[email protected]> - 5.12.11-16
781+
- Fix CVE-2025-30348
782+
792783
* Fri Feb 14 2025 Archana Shettigar <[email protected]> - 5.12.11-15
793784
- Add patch to resolve CVE-2024-25580 & CVE-2023-34410
794785

0 commit comments

Comments
 (0)