Compare commits

...
Sign in to create a new pull request.

17 commits

Author SHA1 Message Date
Jan Grulich
c7a3be5056 Backport CVE fixes and fix for a crash in fontconfig database 2025-06-23 10:36:13 +02:00
Jan Grulich
df2500bbd6 Add new files to %files section 2025-06-17 10:45:24 +02:00
Jan Grulich
16952a887f 6.8.3 2025-06-16 19:00:41 +02:00
Jan Grulich
6189d48620 Merge branch 'f42' into f41 2025-02-13 12:56:15 +01:00
Jan Grulich
863cbf0f5e Merge branch 'rawhide' into f41 2025-02-06 08:10:25 +01:00
Jan Grulich
2bf7009d66 Merge branch 'rawhide' into f41 2025-02-03 10:20:11 +01:00
Jan Grulich
db2bf6d45f Merge branch 'rawhide' into f41 2025-01-16 13:26:27 +01:00
Jan Grulich
5162b8796b Merge branch 'rawhide' into f41 2025-01-13 09:44:52 +01:00
Jan Grulich
e28e94a774 Merge branch 'rawhide' into f41 2025-01-08 18:56:59 +01:00
Jan Grulich
c101f62b52 Merge branch 'rawhide' into f41 2024-12-17 15:32:10 +01:00
Jan Grulich
4597cbd8f0 Merge branch 'rawhide' into f41 2024-12-16 12:26:29 +01:00
Jan Grulich
49622cb476 Merge branch 'rawhide' into f41 2024-12-10 10:54:55 +01:00
Jan Grulich
a0cc74441c Merge branch 'rawhide' into f41 2024-12-07 20:05:25 +01:00
Jan Grulich
795c4adb0b Merge branch 'rawhide' into f41 2024-12-06 12:14:22 +01:00
Jan Grulich
23ff8b464c Merge branch 'rawhide' into f41 2024-10-30 09:32:50 +01:00
Jan Grulich
b5774228fe Rebase a11y atspi patch to Qt 6.7 2024-10-21 13:16:17 +02:00
Jan Grulich
3a3db7648f Backport - a11y atspi: Watch for enabled status change 2024-10-21 13:04:35 +02:00
11 changed files with 19175 additions and 18199 deletions

1
.gitignore vendored
View file

@ -32,3 +32,4 @@
/qtbase-everywhere-src-6.8.0.tar.xz
/qtbase-everywhere-src-6.8.1.tar.xz
/qtbase-everywhere-src-6.8.2.tar.xz
/qtbase-everywhere-src-6.8.3.tar.xz

View file

@ -0,0 +1,230 @@
From d29b3721988d64fdd10050918e376ae9fad8117f Mon Sep 17 00:00:00 2001
From: Shawn Rutledge <shawn.rutledge@qt.io>
Date: Thu, 27 Mar 2025 15:17:21 +0100
Subject: [PATCH] QTextMarkdownImporter: Fix heap-buffer-overflow
After finding the end marker `---`, the code expected more characters
beyond: typically at least a trailing newline. But QStringView::sliced()
crashes if asked for a substring that starts at or beyond the end.
Now it's restructured into a separate splitFrontMatter() function, and
we're stricter, tolerating only `---\n` or `---\r\n` as marker lines.
So the code is easier to prove correct, and we don't need to check
characters between the end of the marker and the end of the line
(to allow inadvertent whitespace, for example). If the markers are
not valid, the Markdown parser will see them as thematic breaks,
as it would have done if we were not extracting the Front Matter
beforehand.
Amends e10c9b5c0f8f194a79ce12dcf9b6b5cb19976942 and
bffddc6a993c4b6b64922e8d327bdf32e0d4975a
Credit to OSS-Fuzz which found this as issue 42533775.
[ChangeLog][QtGui][Text] Fixed a heap buffer overflow in
QTextMarkdownImporter. The first marker for Front Matter
must begin at the first character of a Markdown document,
and both markers must be exactly ---\n or ---\r\n.
Done-with: Marc Mutz <marc.mutz@qt.io>
Fixes: QTBUG-135284
Change-Id: I66412d21ecc0c4eabde443d70865ed2abad86d89
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 25986746947798e1a22d0830d3bcb11a55fcd3ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit eced22d7250fc7ba4dbafa1694bf149c2259d9ea)
(cherry picked from commit 9e59a924a04606c386b970ee6c9c7819cdd7ae1a)
---
diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp
index 5f7ef22..137a0bd 100644
--- a/src/gui/text/qtextmarkdownimporter.cpp
+++ b/src/gui/text/qtextmarkdownimporter.cpp
@@ -28,7 +28,8 @@
static const QChar qtmi_Newline = u'\n';
static const QChar qtmi_Space = u' ';
-static constexpr auto markerString() noexcept { return "---"_L1; }
+static constexpr auto lfMarkerString() noexcept { return "---\n"_L1; }
+static constexpr auto crlfMarkerString() noexcept { return "---r\n"_L1; }
// TODO maybe eliminate the margins after all views recognize BlockQuoteLevel, CSS can format it, etc.
static const int qtmi_BlockQuoteIndent =
@@ -120,6 +121,47 @@
{
}
+/*! \internal
+ Split any Front Matter from the Markdown document \a md.
+ Returns a pair of QStringViews: if \a md begins with qualifying Front Matter
+ (according to the specification at https://jekyllrb.com/docs/front-matter/ ),
+ put it into the \c frontMatter view, omitting both markers; and put the remaining
+ Markdown into \c rest. If no Front Matter is found, return all of \a md in \c rest.
+*/
+static auto splitFrontMatter(QStringView md)
+{
+ struct R {
+ QStringView frontMatter, rest;
+ explicit operator bool() const noexcept { return !frontMatter.isEmpty(); }
+ };
+
+ const auto NotFound = R{{}, md};
+
+ /* Front Matter must start with '---\n' or '---\r\n' on the very first line,
+ and Front Matter must end with another such line.
+ If that is not the case, we return NotFound: then the whole document is
+ to be passed on to the Markdown parser, in which '---\n' is interpreted
+ as a "thematic break" (like <hr/> in HTML). */
+ QLatin1StringView marker;
+ if (md.startsWith(lfMarkerString()))
+ marker = lfMarkerString();
+ else if (md.startsWith(crlfMarkerString()))
+ marker = crlfMarkerString();
+ else
+ return NotFound;
+
+ const auto frontMatterStart = marker.size();
+ const auto endMarkerPos = md.indexOf(marker, frontMatterStart);
+
+ if (endMarkerPos < 0 || md[endMarkerPos - 1] != QChar::LineFeed)
+ return NotFound;
+
+ Q_ASSERT(frontMatterStart < md.size());
+ Q_ASSERT(endMarkerPos < md.size());
+ const auto frontMatter = md.sliced(frontMatterStart, endMarkerPos - frontMatterStart);
+ return R{frontMatter, md.sliced(endMarkerPos + marker.size())};
+}
+
void QTextMarkdownImporter::import(const QString &markdown)
{
MD_PARSER callbacks = {
@@ -144,21 +186,14 @@
qCDebug(lcMD) << "default font" << defaultFont << "mono font" << m_monoFont;
QStringView md = markdown;
- if (m_features.testFlag(QTextMarkdownImporter::FeatureFrontMatter) && md.startsWith(markerString())) {
- qsizetype endMarkerPos = md.indexOf(markerString(), markerString().size() + 1);
- if (endMarkerPos > 4) {
- qsizetype firstLinePos = 4; // first line of yaml
- while (md.at(firstLinePos) == '\n'_L1 || md.at(firstLinePos) == '\r'_L1)
- ++firstLinePos;
- auto frontMatter = md.sliced(firstLinePos, endMarkerPos - firstLinePos);
- firstLinePos = endMarkerPos + 4; // first line of markdown after yaml
- while (md.size() > firstLinePos && (md.at(firstLinePos) == '\n'_L1 || md.at(firstLinePos) == '\r'_L1))
- ++firstLinePos;
- md = md.sliced(firstLinePos);
- doc->setMetaInformation(QTextDocument::FrontMatter, frontMatter.toString());
- qCDebug(lcMD) << "extracted FrontMatter: size" << frontMatter.size();
+ if (m_features.testFlag(QTextMarkdownImporter::FeatureFrontMatter)) {
+ if (const auto split = splitFrontMatter(md)) {
+ doc->setMetaInformation(QTextDocument::FrontMatter, split.frontMatter.toString());
+ qCDebug(lcMD) << "extracted FrontMatter: size" << split.frontMatter.size();
+ md = split.rest;
}
}
+
const auto mdUtf8 = md.toUtf8();
m_cursor.beginEditBlock();
md_parse(mdUtf8.constData(), MD_SIZE(mdUtf8.size()), &callbacks, this);
diff --git a/tests/auto/gui/text/qtextmarkdownimporter/data/front-marker-malformed1.md b/tests/auto/gui/text/qtextmarkdownimporter/data/front-marker-malformed1.md
new file mode 100644
index 0000000..8923d75
--- /dev/null
+++ b/tests/auto/gui/text/qtextmarkdownimporter/data/front-marker-malformed1.md
@@ -0,0 +1,3 @@
+---
+name: "Pluto"---
+Pluto may not be a planet. And this document does not contain Front Matter.
diff --git a/tests/auto/gui/text/qtextmarkdownimporter/data/front-marker-malformed2.md b/tests/auto/gui/text/qtextmarkdownimporter/data/front-marker-malformed2.md
new file mode 100644
index 0000000..1c03291
--- /dev/null
+++ b/tests/auto/gui/text/qtextmarkdownimporter/data/front-marker-malformed2.md
@@ -0,0 +1,5 @@
+---
+name: "Sloppy"
+---
+This document has trailing whitespace after its second Front Matter marker.
+Therefore the marker does not qualify, and the document does not have Front Matter.
diff --git a/tests/auto/gui/text/qtextmarkdownimporter/data/front-marker-malformed3.md b/tests/auto/gui/text/qtextmarkdownimporter/data/front-marker-malformed3.md
new file mode 100644
index 0000000..9621704
--- /dev/null
+++ b/tests/auto/gui/text/qtextmarkdownimporter/data/front-marker-malformed3.md
@@ -0,0 +1,4 @@
+---
+name: "Aborted YAML"
+description: "The ending marker does not end with a newline, so it's invalid."
+---
\ No newline at end of file
diff --git a/tests/auto/gui/text/qtextmarkdownimporter/data/oss-fuzz-42533775.md b/tests/auto/gui/text/qtextmarkdownimporter/data/oss-fuzz-42533775.md
new file mode 100644
index 0000000..04ff53a
--- /dev/null
+++ b/tests/auto/gui/text/qtextmarkdownimporter/data/oss-fuzz-42533775.md
@@ -0,0 +1 @@
+--- ---
\ No newline at end of file
diff --git a/tests/auto/gui/text/qtextmarkdownimporter/data/yaml-crlf.md b/tests/auto/gui/text/qtextmarkdownimporter/data/yaml-crlf.md
new file mode 100644
index 0000000..c3e5243
--- /dev/null
+++ b/tests/auto/gui/text/qtextmarkdownimporter/data/yaml-crlf.md
@@ -0,0 +1,10 @@
+---
+name: "Venus"
+discoverer: "Galileo Galilei"
+title: "A description of the planet Venus"
+keywords:
+ - planets
+ - solar system
+ - astronomy
+---
+*Venus* is the second planet from the Sun, orbiting it every 224.7 Earth days.
diff --git a/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp b/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp
index d9fe000..1a71b48 100644
--- a/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp
+++ b/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp
@@ -548,6 +548,7 @@
QTest::addColumn<QString>("warning");
QTest::newRow("fuzz20450") << "attempted to insert into a list that no longer exists";
QTest::newRow("fuzz20580") << "";
+ QTest::newRow("oss-fuzz-42533775") << ""; // caused a heap-buffer-overflow
}
void tst_QTextMarkdownImporter::pathological() // avoid crashing on crazy input
@@ -644,15 +645,21 @@
void tst_QTextMarkdownImporter::frontMatter_data()
{
QTest::addColumn<QString>("inputFile");
+ QTest::addColumn<int>("expectedFrontMatterSize");
QTest::addColumn<int>("expectedBlockCount");
- QTest::newRow("yaml + markdown") << QFINDTESTDATA("data/yaml.md") << 1;
- QTest::newRow("yaml only") << QFINDTESTDATA("data/yaml-only.md") << 0;
+ QTest::newRow("yaml + markdown") << QFINDTESTDATA("data/yaml.md") << 140 << 1;
+ QTest::newRow("yaml + markdown with CRLFs") << QFINDTESTDATA("data/yaml-crlf.md") << 140 << 1;
+ QTest::newRow("yaml only") << QFINDTESTDATA("data/yaml-only.md") << 59 << 0;
+ QTest::newRow("malformed 1") << QFINDTESTDATA("data/front-marker-malformed1.md") << 0 << 1;
+ QTest::newRow("malformed 2") << QFINDTESTDATA("data/front-marker-malformed2.md") << 0 << 2;
+ QTest::newRow("malformed 3") << QFINDTESTDATA("data/front-marker-malformed3.md") << 0 << 1;
}
void tst_QTextMarkdownImporter::frontMatter()
{
QFETCH(QString, inputFile);
+ QFETCH(int, expectedFrontMatterSize);
QFETCH(int, expectedBlockCount);
QFile f(inputFile);
@@ -672,7 +679,9 @@
++blockCount;
}
QCOMPARE(blockCount, expectedBlockCount); // yaml is not part of the markdown text
- QCOMPARE(doc.metaInformation(QTextDocument::FrontMatter), yaml); // without fences
+ if (expectedFrontMatterSize)
+ QCOMPARE(doc.metaInformation(QTextDocument::FrontMatter), yaml); // without fences
+ QCOMPARE(doc.metaInformation(QTextDocument::FrontMatter).size(), expectedFrontMatterSize);
}
void tst_QTextMarkdownImporter::toRawText_data()

View file

@ -0,0 +1,60 @@
From bbeccc0c22e520f46f0b33e281fa5ac85ac9c727 Mon Sep 17 00:00:00 2001
From: Mårten Nordheim <marten.nordheim@qt.io>
Date: Mon, 17 Mar 2025 14:22:11 +0100
Subject: [PATCH] QFileSystemEngine/Win: Use GetTempPath2 when available
Because the documentation for GetTempPath nows says apps should call
GetTempPath2.[0]
Starting with Windows 11[1], and recently Windows 10[2],
GetTempPath2 was added. The difference being that elevated
processes are returned a different directory. Usually
'C:\Windows\SystemTemp'.
Currently temporary files of an elevated process may be placed in a
world write-able location. GetTempPath2, by default, but can be
overridden, places it in a directory that's only accessible by SYSTEM
and administrators.
[0] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppathw#remarks
[1] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2w
(Minimum supported client - Windows 11 Build 22000)
[2] https://blogs.windows.com/windows-insider/2025/03/13/releasing-windows-10-build-19045-5674-to-the-release-preview-channel/
(This update enables system processes to store temporary files ...)
[ChangeLog][QtCore][Important Behavior Changes] On
Windows, generating temporary directories for processes with elevated
privileges may now return a different path with a stricter
set of permissions. Please consult Microsoft's documentation from when
they made the same change for the .NET framework:
https://support.microsoft.com/en-us/topic/gettemppath-changes-in-windows-february-cumulative-update-preview-4cc631fb-9d97-4118-ab6d-f643cd0a7259
Pick-to: 6.5 5.15
Change-Id: I5caf11151fb2f711bbc5599231f140598b3c9d03
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 69633bcb58e681bac5bff3744e5a2352788dc36c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 6a684a53b371ec483b27bf243af24819be63f85f)
---
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 8300c3b..6ea1f1b 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -1635,7 +1635,15 @@
{
QString ret;
wchar_t tempPath[MAX_PATH];
- const DWORD len = GetTempPath(MAX_PATH, tempPath);
+ using GetTempPathPrototype = DWORD (WINAPI *)(DWORD, LPWSTR);
+ // We try to resolve GetTempPath2 and use that, otherwise fall back to GetTempPath:
+ static GetTempPathPrototype getTempPathW = []() {
+ const HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
+ if (auto *func = QFunctionPointer(GetProcAddress(kernel32, "GetTempPath2W")))
+ return GetTempPathPrototype(func);
+ return GetTempPath;
+ }();
+ const DWORD len = getTempPathW(MAX_PATH, tempPath);
if (len) { // GetTempPath() can return short names, expand.
wchar_t longTempPath[MAX_PATH];
const DWORD longLen = GetLongPathName(tempPath, longTempPath, MAX_PATH);

View file

@ -0,0 +1,21 @@
diff --git a/src/corelib/io/qdataurl.cpp b/src/corelib/io/qdataurl.cpp
index 65b934b3f67..c5ecca8fb82 100644
--- a/src/corelib/io/qdataurl.cpp
+++ b/src/corelib/io/qdataurl.cpp
@@ -47,10 +47,10 @@ Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &uri, QString &mimeType, QByteArray
QLatin1StringView textPlain;
constexpr auto charset = "charset"_L1;
if (QLatin1StringView{data}.startsWith(charset, Qt::CaseInsensitive)) {
- qsizetype i = charset.size();
- while (data.at(i) == ' ')
- ++i;
- if (data.at(i) == '=')
+ QByteArrayView copy = data.sliced(charset.size());
+ while (copy.startsWith(' '))
+ copy.slice(1);
+ if (copy.startsWith('='))
textPlain = "text/plain;"_L1;
}

View file

@ -45,8 +45,8 @@ BuildRequires: pkgconfig(libsystemd)
Name: qt6-qtbase
Summary: Qt6 - QtBase components
Version: 6.8.2
Release: 3%{?dist}
Version: 6.8.3
Release: 2%{?dist}
License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0
Url: http://qt-project.org/
@ -96,9 +96,9 @@ Patch56: qtbase-mysql.patch
Patch58: qtbase-libglvnd.patch
# upstream patches
Patch100: qtbase-qtlocale-try-to-survive-being-created-during-application-shut-down.patch
Patch101: qtbase-qsystemlocale-bail-out-if-accessed-post-destruction.patch
Patch102: qtbase-qlibraryinfo-speedup-checking-if-qt-conf-resource-exists.patch
Patch100: CVE-2025-3512-qtbase-6.8.patch
Patch101: CVE-2025-4211-qtbase-6.8.patch
Patch102: CVE-2025-5455-qtbase-6.8.patch
## upstream patches from Qt 6.9
Patch150: qtbase-extract-emoji-data-from-unicode-files.patch
@ -112,6 +112,8 @@ Patch157: qtbase-fontconfig-fix-detection-of-color-fonts.patch
Patch158: qtbase-support-variation-selector-when-emoji-segmenter-is-disabled.patch
Patch159: qtbase-treat-variation-selectors-as-ignorable-chars.patch
Patch160: qtbase-fix-possible-crash-in-fontconfig-database.patch
# Do not check any files in %%{_qt6_plugindir}/platformthemes/ for requires.
# Those themes are there for platform integration. If the required libraries are
# not there, the platform to integrate with isn't either. Then Qt will just
@ -443,7 +445,7 @@ translationdir=%{_qt6_translationdir}
Name: Qt6
Description: Qt6 Configuration
Version: 6.8.2
Version: 6.8.3
EOF
# rpm macros
@ -609,6 +611,9 @@ make check -k ||:
%dir %{_qt6_libdir}/cmake/Qt6PrintSupport
%dir %{_qt6_libdir}/cmake/Qt6Sql
%dir %{_qt6_libdir}/cmake/Qt6Test
%dir %{_qt6_libdir}/cmake/Qt6TestInternalsPrivate
%dir %{_qt6_libdir}/cmake/Qt6TestInternalsPrivate/3rdparty
%dir %{_qt6_libdir}/cmake/Qt6TestInternalsPrivate/3rdparty/cmake
%dir %{_qt6_libdir}/cmake/Qt6Widgets
%dir %{_qt6_libdir}/cmake/Qt6WidgetsTools
%dir %{_qt6_libdir}/cmake/Qt6Xml
@ -727,6 +732,8 @@ make check -k ||:
%{_qt6_libdir}/cmake/Qt6Sql/Qt6Sql*.cmake
%{_qt6_libdir}/cmake/Qt6Sql/Qt6QSQLiteDriverPlugin*.cmake
%{_qt6_libdir}/cmake/Qt6Test/*.cmake
%{_qt6_libdir}/cmake/Qt6TestInternalsPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6TestInternalsPrivate/3rdparty/cmake/*.cmake
%{_qt6_libdir}/cmake/Qt6Widgets/*.cmake
%{_qt6_libdir}/cmake/Qt6WidgetsTools/*.cmake
%{_qt6_libdir}/cmake/Qt6Xml/*.cmake
@ -756,6 +763,7 @@ make check -k ||:
%{_qt6_metatypesdir}/qt6xml_*_metatypes.json
%{_qt6_libdir}/pkgconfig/*.pc
%{_qt6_mkspecsdir}/*
%{_qt6_descriptionsdir}/TestInternalsPrivate.json
## private-devel globs
%exclude %{_qt6_headerdir}/*/%{qt_version}/
@ -910,6 +918,12 @@ make check -k ||:
%changelog
* Mon Jun 23 2025 Jan Grulich <jgrulich@redhat.com> - 6.8.3-3
- Backport CVE fixes and fix for a crash in fontconfig database
* Mon Jun 16 2025 Jan Grulich <jgrulich@redhat.com> - 6.8.3-1
- 6.8.3
* Thu Feb 13 2025 Jan Grulich <jgrulich@redhat.com> - 6.8.2-3
- Fix rendering of combined emojis

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,100 @@
From 30d2cc9f2ebf42af5982962c4f50ffb124189e54 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Fri, 28 Mar 2025 13:24:43 +0100
Subject: [PATCH] Fix possible crash in FontConfig database
In the FontConfig font database, when we registered alternative
names for the same font, we would just copy the existing user
data (the FontFile struct) from the original font.
However, this did not account for the fact that registerFont()
may in some cases delete fonts from the database if they are
being overwritten, which will also delete the user data.
Therefore the existing FontFile struct is not guaranteed to
be valid once the font database has taken ownership.
This was pre-existing, but it started happening on some
systems after 1d6f71779f05df1af3daacd48f309cd92523152a because
this change will cause some fonts to be seen as identical
which were not before.
Fixes: QTBUG-135264
Change-Id: I913bf13dc8069d952a4cdc5fa5544594be1cdba1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 11620f97f6fb067aa0dce2ee0b1f8ca738c66695)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 3688d4201185e366c49584560aa66445c738864e)
---
src/gui/text/unix/qfontconfigdatabase.cpp | 43 +++++++++++++++++++----
1 file changed, 37 insertions(+), 6 deletions(-)
diff --git a/src/gui/text/unix/qfontconfigdatabase.cpp b/src/gui/text/unix/qfontconfigdatabase.cpp
index 4f7964c9..2eac77d3 100644
--- a/src/gui/text/unix/qfontconfigdatabase.cpp
+++ b/src/gui/text/unix/qfontconfigdatabase.cpp
@@ -467,9 +467,7 @@ static void populateFromPattern(FcPattern *pattern,
writingSystems.setSupported(QFontDatabase::Other);
}
- FontFile *fontFile = new FontFile;
- fontFile->fileName = QString::fromLocal8Bit((const char *)file_value);
- fontFile->indexValue = indexValue;
+ QString fileName = QString::fromLocal8Bit((const char *)file_value);
QFont::Style style = (slant_value == FC_SLANT_ITALIC)
? QFont::StyleItalic
@@ -505,7 +503,25 @@ static void populateFromPattern(FcPattern *pattern,
applicationFont->properties.append(properties);
}
- QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,colorFont,writingSystems,fontFile);
+ {
+ FontFile *fontFile = new FontFile;
+ fontFile->fileName = fileName;
+ fontFile->indexValue = indexValue;
+ QPlatformFontDatabase::registerFont(familyName,
+ styleName,
+ QLatin1StringView((const char *)foundry_value),
+ weight,
+ style,
+ stretch,
+ antialias,
+ scalable,
+ pixel_size,
+ fixedPitch,
+ colorFont,
+ writingSystems,
+ fontFile);
+ }
+
if (applicationFont != nullptr && face != nullptr && db != nullptr) {
db->addNamedInstancesForFace(face,
indexValue,
@@ -551,8 +567,25 @@ static void populateFromPattern(FcPattern *pattern,
applicationFont->properties.append(properties);
}
- FontFile *altFontFile = new FontFile(*fontFile);
- QPlatformFontDatabase::registerFont(altFamilyName, altStyleName, QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,colorFont,writingSystems,altFontFile);
+
+ {
+ FontFile *altFontFile = new FontFile;
+ altFontFile->fileName = fileName;
+ altFontFile->indexValue = indexValue;
+ QPlatformFontDatabase::registerFont(altFamilyName,
+ altStyleName,
+ QLatin1StringView((const char *)foundry_value),
+ weight,
+ style,
+ stretch,
+ antialias,
+ scalable,
+ pixel_size,
+ fixedPitch,
+ colorFont,
+ writingSystems,
+ altFontFile);
+ }
} else {
QPlatformFontDatabase::registerAliasToFontFamily(familyName, altFamilyName);
}

View file

@ -1,50 +0,0 @@
From a43c7e58046604796aa69974ea1c5d3e2648c755 Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
Date: Fri, 24 Jan 2025 11:07:58 -0800
Subject: [PATCH] QLibraryInfo: speed up checking if ":/qt/etc/qt.conf"
resource exists
Go straight for QResource, because this is run very early in Qt's
initialization, usually as a result of some debug message, via
QLoggingRegistry::initializeRules(). This bypasses the need to create
QResourceFileEnginePrivate, QResourceFileEngine, QFileInfoPrivate, and
QFileInfo, all of which would end up in this .isValid() call.
Additionally, I'm making it query in the C locale, which will also avoid
initializing the system & default QLocales. If a resource exists in any
language, the C locale query will find it.
Task-number: QTBUG-133206
Change-Id: I434b498903d793c12d35fffd3e297bfdbdc1b6fe
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d59e640c868f3db2d661970f3d34a22013d49053)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ae2502b4ad3d1215211bf4ed44037a40f52a313d)
---
src/corelib/global/qlibraryinfo.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 94f3e60deba..5f6042be29d 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -6,6 +6,7 @@
#include "qstringlist.h"
#include "qfile.h"
#if QT_CONFIG(settings)
+#include "qresource.h"
#include "qsettings.h"
#endif
#include "qlibraryinfo.h"
@@ -103,7 +104,7 @@ static std::unique_ptr<QSettings> findConfiguration()
return std::make_unique<QSettings>(*qtconfManualPath, QSettings::IniFormat);
QString qtconfig = QStringLiteral(":/qt/etc/qt.conf");
- if (QFile::exists(qtconfig))
+ if (QResource(qtconfig, QLocale::c()).isValid())
return std::make_unique<QSettings>(qtconfig, QSettings::IniFormat);
#ifdef Q_OS_DARWIN
CFBundleRef bundleRef = CFBundleGetMainBundle();
--
GitLab

View file

@ -1,48 +0,0 @@
From 2ef615228bba9a8eb282437bfb7472f925610e89 Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
Date: Fri, 24 Jan 2025 10:28:30 -0800
Subject: [PATCH] QSystemLocale: bail out if accessed post-destruction
There's little we can do, but a lot of content ends up in QLocale very
late in the execution. Let's at least not crash.
Task-number: QTBUG-133206
Change-Id: I77d41141cb115147f9befffdd5e69dac19c96044
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e32f28034ad2383393645777bcd96eab3f696076)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit d5c5f9f3529b384d0d4bea2d51f0ad6a3d57481d)
---
src/corelib/text/qlocale_unix.cpp | 2 ++
src/corelib/text/qlocale_win.cpp | 2 ++
2 files changed, 4 insertions(+)
diff --git a/src/corelib/text/qlocale_unix.cpp b/src/corelib/text/qlocale_unix.cpp
index a934f24c016..91dbb74c207 100644
--- a/src/corelib/text/qlocale_unix.cpp
+++ b/src/corelib/text/qlocale_unix.cpp
@@ -127,6 +127,8 @@ QLocale QSystemLocale::fallbackLocale() const
QVariant QSystemLocale::query(QueryType type, QVariant &&in) const
{
QSystemLocaleData *d = qSystemLocaleData();
+ if (!d)
+ return QVariant();
if (type == LocaleChanged) {
d->readEnvironment();
diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp
index 9fdb46a4c92..793751daaf0 100644
--- a/src/corelib/text/qlocale_win.cpp
+++ b/src/corelib/text/qlocale_win.cpp
@@ -828,6 +828,8 @@ QLocale QSystemLocale::fallbackLocale() const
QVariant QSystemLocale::query(QueryType type, QVariant &&in) const
{
QSystemLocalePrivate *d = systemLocalePrivate();
+ if (!d)
+ return QVariant();
switch(type) {
case DecimalPoint:
return d->decimalPoint();
--
GitLab

View file

@ -1,48 +0,0 @@
From 12d4bf1ab52748cb84894f50d437064b439e0b7d Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
Date: Fri, 24 Jan 2025 10:43:38 -0800
Subject: [PATCH] QLocale: try to survive being created during application shut
down
QLocale is very often accessed during global static destructors, so
let's try and survive if the default has already been destroyed. In that
case, we shall fall back to the C locale.
I've placed the call to systemData(), which updates the system locale,
before the initialization of defaultLocalePrivate, as the initialization
of the latter depends on the former.
Task-number: QTBUG-133206
Change-Id: I48e29b45f9be4514336cfffdf5affa5631a956a3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Albert Astals Cid <aacid@kde.org>
(cherry picked from commit e0a1f491567f2495443babc5aa36a038260f96c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit bcc0e6124a2ec80df535178d056324433f9ff984)
---
src/corelib/text/qlocale.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index 4f5b5452648..eff083b3d94 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -1112,10 +1112,13 @@ QLocale::QLocale(QStringView name)
*/
QLocale::QLocale()
- : d(*defaultLocalePrivate)
+ : d(c_private())
{
- // Make sure system data is up to date:
- systemData();
+ if (!defaultLocalePrivate.isDestroyed()) {
+ // Make sure system data is up to date:
+ systemData();
+ d = *defaultLocalePrivate;
+ }
}
/*!
--
GitLab

View file

@ -1 +1 @@
SHA512 (qtbase-everywhere-src-6.8.2.tar.xz) = 4a074aca1c8bcca536fd428c969c0119f5131d0d52b67028edbb75a81dc6e0c15394f69e29cef513e6d8c6e93384cedc38dd03b0eed6ab1bbafbe2b5bbc85799
SHA512 (qtbase-everywhere-src-6.8.3.tar.xz) = ef364f939f23b622f67d21833c2dbf1fb74531d9a1e25b6d2e94ea5d747a40f20c6c3a24abef1e9710287366b7cb54dd090350d315601317779235c20743cc81