diff options
author | Sam James <sam@gentoo.org> | 2022-06-26 09:22:31 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-06-26 09:25:13 +0100 |
commit | cb10b0356e62b2521c0d4592a35b5dfb6e5cd2ca (patch) | |
tree | 5457c5f0c744f883be8f81b2a60985ef9315eaf4 /dev-qt/qtcore/files | |
parent | sci-libs/pytorch: depends on the caffe2 exact version (diff) | |
download | gentoo-cb10b0356e62b2521c0d4592a35b5dfb6e5cd2ca.tar.gz gentoo-cb10b0356e62b2521c0d4592a35b5dfb6e5cd2ca.tar.bz2 gentoo-cb10b0356e62b2521c0d4592a35b5dfb6e5cd2ca.zip |
dev-qt/qtcore: backport FORTIFY_SOURCE=3 patch
GCC 12 is now in ~arch and we're likely to get more people trying
out F_S=3 as a result. This patch is now in Qt5PatchCollection
and given the previous workaround ended up being insufficient
(it's not enough to force F_S=2 in qtcore, as reverse deps
end up being broken if _they_ are built with F_S=3, even
though the cause is in qtcore), let's backport the fix now.
Bug: https://bugs.gentoo.org/847145
Closes: https://bugs.gentoo.org/852974
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-qt/qtcore/files')
-rw-r--r-- | dev-qt/qtcore/files/qtcore-5.15.5-fortify-source-3.patch | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/dev-qt/qtcore/files/qtcore-5.15.5-fortify-source-3.patch b/dev-qt/qtcore/files/qtcore-5.15.5-fortify-source-3.patch new file mode 100644 index 000000000000..1be46b496cf9 --- /dev/null +++ b/dev-qt/qtcore/files/qtcore-5.15.5-fortify-source-3.patch @@ -0,0 +1,61 @@ +https://invent.kde.org/qt/qt/qtbase/-/commit/6d3d164bec17876f5b24ae9102767ef1236aa37b + +From 6d3d164bec17876f5b24ae9102767ef1236aa37b Mon Sep 17 00:00:00 2001 +From: Sam James <sam@gentoo.org> +Date: Mon, 20 Jun 2022 20:35:12 +0100 +Subject: [PATCH] QArrayData: fix UB via reinterpret_cast (crash with + FORTIFY_SOURCE=3) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +FORTIFY_SOURCE=3 is a new level of FORTIFY_SOURCE available with GCC 12+. + +With Qt 5.15, it ends up triggering UB in the pointer arithmetic +in QArrayData which breaks various FOSS applications using qtcore. + +Qt upstream fixed this independently for 6.x (in at least +eab6eb64d2fab21c4791738323ca7d670a907de1) but did so at the same time as +various internal changes and hence is not appropriate for cherry-picking to 5.15.x. + +I reported the issue to Qt (QTBUG-103782) and they've created a fix for 5.15 which +is not yet public but based on the description in the bug, should be functionally +the same as this. They have not backported the intrusive internal changes +from 6.x. + +Originally grabbed from https://build.opensuse.org/package/view_file/KDE:Qt:5.15/libqt5-qtbase/mitigate-FORTIFY_SOURCE-3.patch. + +Bug: https://bugs.gentoo.org/847145 +Bug: https://bugs.gentoo.org/852974 +Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104964 +Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105709 +Task-number: QTBUG-103782 +Thanks-to: Martin Liška <mliska@suse.cz> +--- a/src/corelib/tools/qarraydata.h ++++ b/src/corelib/tools/qarraydata.h +@@ -42,6 +42,7 @@ + + #include <QtCore/qrefcount.h> + #include <string.h> ++#include <cstdint> + + QT_BEGIN_NAMESPACE + +@@ -58,14 +59,14 @@ struct Q_CORE_EXPORT QArrayData + { + Q_ASSERT(size == 0 + || offset < 0 || size_t(offset) >= sizeof(QArrayData)); +- return reinterpret_cast<char *>(this) + offset; ++ return reinterpret_cast<void *> (reinterpret_cast<uintptr_t>(this) + offset); + } + + const void *data() const + { + Q_ASSERT(size == 0 + || offset < 0 || size_t(offset) >= sizeof(QArrayData)); +- return reinterpret_cast<const char *>(this) + offset; ++ return reinterpret_cast<void *> (reinterpret_cast<uintptr_t>(this) + offset); + } + + // This refers to array data mutability, not "header data" represented by +GitLab |