summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEsteve Varela Colominas <esteve.varela@gmail.com>2022-04-24 19:52:29 +0200
committerGeorgy Yakovlev <gyakovlev@gentoo.org>2022-04-24 18:42:29 -0700
commit35dad0d1895f480f390231f42b3e64b02b148f89 (patch)
tree3d0a45cebc53ba282f7670f8aa5692ced3fc03bb
parentapp-emacs/bnf-mode: new package; add version 0.4.5_pre20220102 (diff)
downloadgentoo-35dad0d1895f480f390231f42b3e64b02b148f89.tar.gz
gentoo-35dad0d1895f480f390231f42b3e64b02b148f89.tar.bz2
gentoo-35dad0d1895f480f390231f42b3e64b02b148f89.zip
net-im/telegram-desktop: Fix use after free affecting multi user
Closes: https://bugs.gentoo.org/837914 Thanks-to: Joe Kappus <joe@wt.gd> Signed-off-by: Esteve Varela Colominas <esteve.varela@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/25184 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
-rw-r--r--net-im/telegram-desktop/files/tdesktop-3.6.1-fix-use-after-free.patch44
-rw-r--r--net-im/telegram-desktop/telegram-desktop-3.6.1-r1.ebuild (renamed from net-im/telegram-desktop/telegram-desktop-3.6.1.ebuild)1
2 files changed, 45 insertions, 0 deletions
diff --git a/net-im/telegram-desktop/files/tdesktop-3.6.1-fix-use-after-free.patch b/net-im/telegram-desktop/files/tdesktop-3.6.1-fix-use-after-free.patch
new file mode 100644
index 000000000000..5a8e6ceedd66
--- /dev/null
+++ b/net-im/telegram-desktop/files/tdesktop-3.6.1-fix-use-after-free.patch
@@ -0,0 +1,44 @@
+Description: Do not capture buttons in AccountsList that belong to inner VerticalLayout widget
+ This fixes a use-after-free error (double destruction) in the main menu right after account switching.
+Bug-Debian: https://bugs.debian.org/1008156
+Bug-Ubuntu: https://launchpad.net/bugs/1967673
+Forwarded: https://github.com/telegramdesktop/tdesktop/pull/24301
+Author: Nicholas Guriev <guriev-ns@ya.ru>
+Last-Update: Sat, 09 Apr 2022 13:47:55 +0300
+
+--- tdesktop-3.6.1-full.orig/Telegram/SourceFiles/settings/settings_information.cpp
++++ tdesktop-3.6.1-full/Telegram/SourceFiles/settings/settings_information.cpp
+@@ -78,9 +78,7 @@
+ int _outerIndex = 0;
+
+ Ui::SlideWrap<Ui::SettingsButton> *_addAccount = nullptr;
+- base::flat_map<
+- not_null<Main::Account*>,
+- base::unique_qptr<Ui::SettingsButton>> _watched;
++ base::flat_map<not_null<Main::Account*>, Ui::SettingsButton*> _watched;
+
+ base::unique_qptr<Ui::PopupMenu> _contextMenu;
+ std::unique_ptr<Ui::VerticalLayoutReorder> _reorder;
+@@ -730,7 +728,7 @@
+ order.reserve(inner->count());
+ for (auto i = 0; i < inner->count(); i++) {
+ for (const auto &[account, button] : _watched) {
+- if (button.get() == inner->widgetAt(i)) {
++ if (button == inner->widgetAt(i)) {
+ order.push_back(account->session().uniqueId());
+ }
+ }
+@@ -769,11 +767,11 @@
+ account,
+ std::move(activate));
+ };
+- button.reset(inner->add(MakeAccountButton(
++ button = inner->add(MakeAccountButton(
+ inner,
+ _controller,
+ account,
+- std::move(callback))));
++ std::move(callback)));
+ }
+ }
+ inner->resizeToWidth(_outer->width());
diff --git a/net-im/telegram-desktop/telegram-desktop-3.6.1.ebuild b/net-im/telegram-desktop/telegram-desktop-3.6.1-r1.ebuild
index d2fc536e145f..4a14450d8da3 100644
--- a/net-im/telegram-desktop/telegram-desktop-3.6.1.ebuild
+++ b/net-im/telegram-desktop/telegram-desktop-3.6.1-r1.ebuild
@@ -77,6 +77,7 @@ PATCHES=(
"${FILESDIR}/tdesktop-3.5.2-musl.patch"
"${FILESDIR}/tdesktop-3.6.0-support-ffmpeg5.patch"
"${FILESDIR}/tdesktop-3.6.1-fix-kwayland-5.93.patch"
+ "${FILESDIR}/tdesktop-3.6.1-fix-use-after-free.patch"
)
# Current desktop-file-utils-0.26 does not understand Version=1.5