summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szuba <marecki@gentoo.org>2023-09-28 09:21:30 +0100
committerMarek Szuba <marecki@gentoo.org>2023-09-28 09:25:01 +0100
commit6e09b30342bb353a0c6603325c27a79332c9e66f (patch)
treeb4fc7bf029994ea62705af128741ff33bdef7350 /app-misc
parentdev-python/python-rtmidi: add 1.5.6 (diff)
downloadgentoo-6e09b30342bb353a0c6603325c27a79332c9e66f.tar.gz
gentoo-6e09b30342bb353a0c6603325c27a79332c9e66f.tar.bz2
gentoo-6e09b30342bb353a0c6603325c27a79332c9e66f.zip
app-misc/mc: backport upstream fix for mcdiff segfaults
Closes: https://bugs.gentoo.org/914724 Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'app-misc')
-rw-r--r--app-misc/mc/files/mc-4.8.30-mcdiff-segfault.patch36
-rw-r--r--app-misc/mc/mc-4.8.30-r1.ebuild (renamed from app-misc/mc/mc-4.8.30.ebuild)1
2 files changed, 37 insertions, 0 deletions
diff --git a/app-misc/mc/files/mc-4.8.30-mcdiff-segfault.patch b/app-misc/mc/files/mc-4.8.30-mcdiff-segfault.patch
new file mode 100644
index 000000000000..ad752a11816f
--- /dev/null
+++ b/app-misc/mc/files/mc-4.8.30-mcdiff-segfault.patch
@@ -0,0 +1,36 @@
+From dfe3279a365d629ba848f0265108d98d9f12348f Mon Sep 17 00:00:00 2001
+From: Andrew Borodin <aborodin@vmail.ru>
+Date: Sun, 27 Aug 2023 19:32:53 +0300
+Subject: [PATCH] Ticket 4500: mcdiff: segfault when display of line numbers is
+ enabled.
+
+The bug was introduced in 00f84fbf24b5f65381f41c5d6333182bc7921700.
+
+ * (dview_load_options): avoid NULL dereference: don't caclulate the
+ width of line numbers field here because dview->a isn't created yet.
+ * (dview_update): caclulate the width of line numbers field using an
+ actual length of diff lines array.
+
+Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
+--- a/src/diffviewer/ydiff.c
++++ b/src/diffviewer/ydiff.c
+@@ -2366,7 +2366,7 @@ dview_load_options (WDiff * dview)
+ dview->display_symbols = 1;
+ show_numbers = mc_config_get_bool (mc_global.main_config, "DiffView", "show_numbers", FALSE);
+ if (show_numbers)
+- dview->display_numbers = calc_nwidth ((const GArray * const *) dview->a);
++ dview->display_numbers = 1;
+ tab_size = mc_config_get_int (mc_global.main_config, "DiffView", "tab_size", 8);
+ if (tab_size > 0 && tab_size < 9)
+ dview->tab_size = tab_size;
+@@ -2885,6 +2885,10 @@ dview_update (WDiff * dview)
+ if (height < 2)
+ return;
+
++ /* use an actual length of dview->a */
++ if (dview->display_numbers != 0)
++ dview->display_numbers = calc_nwidth ((const GArray * const *) dview->a);
++
+ width1 = dview->half1 + dview->bias;
+ width2 = dview->half2 - dview->bias;
+ if (dview->full)
diff --git a/app-misc/mc/mc-4.8.30.ebuild b/app-misc/mc/mc-4.8.30-r1.ebuild
index e1576c254b12..8bd59fa87beb 100644
--- a/app-misc/mc/mc-4.8.30.ebuild
+++ b/app-misc/mc/mc-4.8.30-r1.ebuild
@@ -50,6 +50,7 @@ S="${WORKDIR}/${MY_P}"
PATCHES=(
"${FILESDIR}"/${PN}-4.8.26-ncurses-mouse.patch
"${FILESDIR}"/${PN}-4.8.29-gentoo-tools.patch
+ "${FILESDIR}"/${PN}-4.8.30-mcdiff-segfault.patch
)
src_prepare() {