commit: e4477d2d7f49b2c48ae89e34e860b103e215d748 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> AuthorDate: Mon Jan 31 20:00:06 2022 +0000 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> CommitDate: Mon Jan 31 20:02:23 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4477d2d
kde-frameworks/ktexteditor: Fix CVE-2022-23853 See also: https://kde.org/info/security/advisory-20220131-1.txt https://mail.kde.org/pipermail/kde-devel/2022-January/000943.html Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> .../ktexteditor-5.90.0-CVE-2022-23853-1.patch | 104 +++++++++++++++++++++ .../ktexteditor-5.90.0-CVE-2022-23853-2.patch | 55 +++++++++++ .../ktexteditor/ktexteditor-5.90.0-r2.ebuild | 61 ++++++++++++ 3 files changed, 220 insertions(+) diff --git a/kde-frameworks/ktexteditor/files/ktexteditor-5.90.0-CVE-2022-23853-1.patch b/kde-frameworks/ktexteditor/files/ktexteditor-5.90.0-CVE-2022-23853-1.patch new file mode 100644 index 000000000000..854cf0da4b2e --- /dev/null +++ b/kde-frameworks/ktexteditor/files/ktexteditor-5.90.0-CVE-2022-23853-1.patch @@ -0,0 +1,104 @@ +From 804e49444c093fe58ec0df2ab436565e50dc147e Mon Sep 17 00:00:00 2001 +From: Christoph Cullmann <[email protected]> +Date: Thu, 20 Jan 2022 09:46:34 +0100 +Subject: [PATCH] only start programs in user's path + +don't use QProcess with just program name +first search the right program in the user's path +--- + src/document/katedocument.cpp | 29 ++++++++++++++++------------ + src/swapfile/kateswapdiffcreator.cpp | 17 ++++++++++++---- + 2 files changed, 30 insertions(+), 16 deletions(-) + +diff --git a/src/document/katedocument.cpp b/src/document/katedocument.cpp +index 01f74da1..05d0e91b 100644 +--- a/src/document/katedocument.cpp ++++ b/src/document/katedocument.cpp +@@ -72,6 +72,7 @@ + #include <QMimeDatabase> + #include <QProcess> + #include <QRegularExpression> ++#include <QStandardPaths> + #include <QTemporaryFile> + #include <QTextCodec> + #include <QTextStream> +@@ -5054,18 +5055,22 @@ void KTextEditor::DocumentPrivate::slotDelayedHandleModOnHd() + // skip that, if document is modified! + // only do that, if the file is still there, else reload makes no sense! + if (m_modOnHd && !isModified() && QFile::exists(url().toLocalFile())) { +- QProcess git; +- const QStringList args{QStringLiteral("cat-file"), QStringLiteral("-e"), QString::fromUtf8(oldDigest)}; +- git.start(QStringLiteral("git"), args); +- if (git.waitForStarted()) { +- git.closeWriteChannel(); +- if (git.waitForFinished()) { +- if (git.exitCode() == 0) { +- // this hash exists still in git => just reload +- m_modOnHd = false; +- m_modOnHdReason = OnDiskUnmodified; +- m_prevModOnHdReason = OnDiskUnmodified; +- documentReload(); ++ // we only want to use git from PATH, cache this ++ static const QString fullGitPath = QStandardPaths::findExecutable(QStringLiteral("git")); ++ if (!fullGitPath.isEmpty()) { ++ QProcess git; ++ const QStringList args{QStringLiteral("cat-file"), QStringLiteral("-e"), QString::fromUtf8(oldDigest)}; ++ git.start(fullGitPath, args); ++ if (git.waitForStarted()) { ++ git.closeWriteChannel(); ++ if (git.waitForFinished()) { ++ if (git.exitCode() == 0) { ++ // this hash exists still in git => just reload ++ m_modOnHd = false; ++ m_modOnHdReason = OnDiskUnmodified; ++ m_prevModOnHdReason = OnDiskUnmodified; ++ documentReload(); ++ } + } + } + } +diff --git a/src/swapfile/kateswapdiffcreator.cpp b/src/swapfile/kateswapdiffcreator.cpp +index 5c515c45..a185123a 100644 +--- a/src/swapfile/kateswapdiffcreator.cpp ++++ b/src/swapfile/kateswapdiffcreator.cpp +@@ -14,6 +14,7 @@ + #include <KMessageBox> + + #include <QDir> ++#include <QStandardPaths> + #include <QTextCodec> + + // BEGIN SwapDiffCreator +@@ -85,17 +86,25 @@ void SwapDiffCreator::viewDiff() + connect(&m_proc, &QProcess::readyRead, this, &SwapDiffCreator::slotDataAvailable, Qt::UniqueConnection); + connect(&m_proc, &QProcess::finished, this, &SwapDiffCreator::slotDiffFinished, Qt::UniqueConnection); + +- // try to start diff process, if we can't be started be done with error +- m_proc.start(QStringLiteral("diff"), QStringList() << QStringLiteral("-u") << m_originalFile.fileName() << m_recoveredFile.fileName()); +- if (!m_proc.waitForStarted()) { ++ // use diff from PATH only => inform if not found at all ++ const QString fullDiffPath = QStandardPaths::findExecutable(QStringLiteral("diff")); ++ if (fullDiffPath.isEmpty()) { + KMessageBox::sorry(nullptr, +- i18n("The diff command could not be started. Please make sure that " ++ i18n("The diff command could not be found. Please make sure that " + "diff(1) is installed and in your PATH."), + i18n("Error Creating Diff")); + deleteLater(); + return; + } + ++ // try to start the diff program, might fail, too ++ m_proc.start(fullDiffPath, QStringList() << QStringLiteral("-u") << m_originalFile.fileName() << m_recoveredFile.fileName()); ++ if (!m_proc.waitForStarted()) { ++ KMessageBox::sorry(nullptr, i18n("The diff command '%1' could not be started.").arg(fullDiffPath), i18n("Error Creating Diff")); ++ deleteLater(); ++ return; ++ } ++ + // process is up and running, we can write data to it + QTextStream ts(&m_proc); + int lineCount = recoverDoc.lines(); +-- +GitLab + diff --git a/kde-frameworks/ktexteditor/files/ktexteditor-5.90.0-CVE-2022-23853-2.patch b/kde-frameworks/ktexteditor/files/ktexteditor-5.90.0-CVE-2022-23853-2.patch new file mode 100644 index 000000000000..8cccfe3a95b0 --- /dev/null +++ b/kde-frameworks/ktexteditor/files/ktexteditor-5.90.0-CVE-2022-23853-2.patch @@ -0,0 +1,55 @@ +From c80f935c345de2e2fb10635202800839ca9697bf Mon Sep 17 00:00:00 2001 +From: Christoph Cullmann <[email protected]> +Date: Thu, 20 Jan 2022 10:30:20 +0100 +Subject: [PATCH] only execute diff in path + +--- + src/dialogs/katedialogs.cpp | 5 +++-- + src/dialogs/katedialogs.h | 1 + + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/dialogs/katedialogs.cpp b/src/dialogs/katedialogs.cpp +index 5b949f36..63a58aee 100644 +--- a/src/dialogs/katedialogs.cpp ++++ b/src/dialogs/katedialogs.cpp +@@ -1317,6 +1317,7 @@ KateModOnHdPrompt::KateModOnHdPrompt(KTextEditor::DocumentPrivate *doc, KTextEdi + : QObject(doc) + , m_doc(doc) + , m_modtype(modtype) ++ , m_fullDiffPath(QStandardPaths::findExecutable(QStringLiteral("diff"))) + , m_proc(nullptr) + , m_diffFile(nullptr) + , m_diffAction(nullptr) +@@ -1334,7 +1335,7 @@ KateModOnHdPrompt::KateModOnHdPrompt(KTextEditor::DocumentPrivate *doc, KTextEdi + m_message->addAction(aAutoReload, false); + connect(aAutoReload, &QAction::triggered, this, &KateModOnHdPrompt::autoReloadTriggered); + +- if (!QStandardPaths::findExecutable(QStringLiteral("diff")).isEmpty()) { ++ if (!m_fullDiffPath.isEmpty()) { + m_diffAction = new QAction(i18n("View &Difference"), this); + m_diffAction->setIcon(QIcon::fromTheme(QStringLiteral("document-multiple"))); + m_diffAction->setToolTip(i18n("Shows a diff of the changes")); +@@ -1394,7 +1395,7 @@ void KateModOnHdPrompt::slotDiff() + // Start a KProcess that creates a diff + m_proc = new KProcess(this); + m_proc->setOutputChannelMode(KProcess::MergedChannels); +- *m_proc << QStringLiteral("diff") << QStringLiteral("-u") << QStringLiteral("-") << m_doc->url().toLocalFile(); ++ *m_proc << m_fullDiffPath << QStringLiteral("-u") << QStringLiteral("-") << m_doc->url().toLocalFile(); + connect(m_proc, &KProcess::readyRead, this, &KateModOnHdPrompt::slotDataAvailable); + connect(m_proc, &KProcess::finished, this, &KateModOnHdPrompt::slotPDone); + +diff --git a/src/dialogs/katedialogs.h b/src/dialogs/katedialogs.h +index 80b611d9..e5574023 100644 +--- a/src/dialogs/katedialogs.h ++++ b/src/dialogs/katedialogs.h +@@ -376,6 +376,7 @@ private: + KTextEditor::DocumentPrivate *m_doc; + QPointer<KTextEditor::Message> m_message; + KTextEditor::ModificationInterface::ModifiedOnDiskReason m_modtype; ++ QString m_fullDiffPath; + KProcess *m_proc; + QTemporaryFile *m_diffFile; + QAction *m_diffAction; +-- +GitLab + diff --git a/kde-frameworks/ktexteditor/ktexteditor-5.90.0-r2.ebuild b/kde-frameworks/ktexteditor/ktexteditor-5.90.0-r2.ebuild new file mode 100644 index 000000000000..4b7520cf0d9f --- /dev/null +++ b/kde-frameworks/ktexteditor/ktexteditor-5.90.0-r2.ebuild @@ -0,0 +1,61 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PVCUT=$(ver_cut 1-2) +QTMIN=5.15.2 +VIRTUALX_REQUIRED="test" +inherit ecm kde.org + +DESCRIPTION="Framework providing a full text editor component" + +LICENSE="LGPL-2+" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" +IUSE="+editorconfig" + +RESTRICT="test" + +DEPEND=" + >=dev-qt/qtdeclarative-${QTMIN}:5 + >=dev-qt/qtgui-${QTMIN}:5 + >=dev-qt/qtprintsupport-${QTMIN}:5 + >=dev-qt/qtwidgets-${QTMIN}:5 + >=dev-qt/qtxml-${QTMIN}:5 + =kde-frameworks/karchive-${PVCUT}*:5 + =kde-frameworks/kauth-${PVCUT}*:5 + =kde-frameworks/kcodecs-${PVCUT}*:5 + =kde-frameworks/kcompletion-${PVCUT}*:5 + =kde-frameworks/kconfig-${PVCUT}*:5 + =kde-frameworks/kconfigwidgets-${PVCUT}*:5 + =kde-frameworks/kcoreaddons-${PVCUT}*:5 + =kde-frameworks/kguiaddons-${PVCUT}*:5 + =kde-frameworks/ki18n-${PVCUT}*:5 + =kde-frameworks/kiconthemes-${PVCUT}*:5 + =kde-frameworks/kio-${PVCUT}*:5 + =kde-frameworks/kitemviews-${PVCUT}*:5 + =kde-frameworks/kjobwidgets-${PVCUT}*:5 + =kde-frameworks/kparts-${PVCUT}*:5 + =kde-frameworks/ktextwidgets-${PVCUT}*:5 + =kde-frameworks/kwidgetsaddons-${PVCUT}*:5 + =kde-frameworks/kxmlgui-${PVCUT}*:5 + =kde-frameworks/sonnet-${PVCUT}*:5 + =kde-frameworks/syntax-highlighting-${PVCUT}*:5 + editorconfig? ( app-text/editorconfig-core-c ) +" +RDEPEND="${DEPEND}" +BDEPEND="test? ( >=kde-frameworks/kservice-${PVCUT}:5 )" + +PATCHES=( + "${FILESDIR}"/${P}-revert-5dce70a9.patch # KDE-bugs 446189, 447525 + "${FILESDIR}"/${P}-KDEBUG-447972.patch + "${FILESDIR}"/${P}-CVE-2022-23853-{1,2}.patch +) + +src_configure() { + local mycmakeargs=( + $(cmake_use_find_package editorconfig EditorConfig) + ) + + ecm_src_configure +}
