[mc] fix segfault if aspell dicts aren't present fix segfault in mcedit when pressing alt-minus

Jindrich Novy jnovy at fedoraproject.org
Tue Jul 31 09:39:16 UTC 2012


commit a3358c0d6fe5da1210d2fe08d762f5c734f7ef7b
Author: Jindrich Novy <jnovy at redhat.com>
Date:   Tue Jul 31 11:42:18 2012 +0200

    fix segfault if aspell dicts aren't present
    fix segfault in mcedit when pressing alt-minus

 mc-altminus.patch |   12 ++++++++++++
 mc-aspell.patch   |   39 +++++++++++++++++++++++++++++++++++++++
 mc.spec           |   10 +++++++++-
 3 files changed, 60 insertions(+), 1 deletions(-)
---
diff --git a/mc-altminus.patch b/mc-altminus.patch
new file mode 100644
index 0000000..9bc9644
--- /dev/null
+++ b/mc-altminus.patch
@@ -0,0 +1,12 @@
+diff -up mc-4.8.4/src/editor/editcmd.c.altminus mc-4.8.4/src/editor/editcmd.c
+--- mc-4.8.4/src/editor/editcmd.c.altminus	2012-07-18 11:30:23.000000000 +0200
++++ mc-4.8.4/src/editor/editcmd.c	2012-07-31 11:21:14.261033325 +0200
+@@ -3496,7 +3496,7 @@ edit_load_back_cmd (WEdit * edit)
+         return FALSE;
+ 
+     edit_stack_iterator--;
+-    if (edit_history_moveto[edit_stack_iterator].filename_vpath != NULL)
++    if (edit_stack_iterator >= 0 && edit_history_moveto[edit_stack_iterator].filename_vpath != NULL)
+         return edit_reload_line (edit, edit_history_moveto[edit_stack_iterator].filename_vpath,
+                                  edit_history_moveto[edit_stack_iterator].line);
+ 
diff --git a/mc-aspell.patch b/mc-aspell.patch
new file mode 100644
index 0000000..8a2ac64
--- /dev/null
+++ b/mc-aspell.patch
@@ -0,0 +1,39 @@
+Index: src/editor/spell.c
+===================================================================
+--- src/editor/spell.c	(revision 94bd4b1f78901cd83406f3daa9a0d0f8f2152321)
++++ src/editor/spell.c	(revision a8429411758003fab3b9f27e6bccad6b6b5c2d3c)
+@@ -72,7 +72,5 @@
+ static const char *(*mc_aspell_config_retrieve) (struct AspellConfig * ths, const char *key);
+ static void (*mc_delete_aspell_speller) (struct AspellSpeller * ths);
+-/*
+-   static void (*mc_delete_aspell_config) (struct AspellConfig * ths);
+- */
++static void (*mc_delete_aspell_config) (struct AspellConfig * ths);
+ static void (*mc_delete_aspell_can_have_error) (struct AspellCanHaveError * ths);
+ static const char *(*mc_aspell_error_message) (const struct AspellCanHaveError * ths);
+@@ -229,5 +227,5 @@
+         goto error_ret;
+ 
+-    if (!g_module_symbol (spell_module, "delete_aspell_config", (void *) &mc_delete_aspell_speller))
++    if (!g_module_symbol (spell_module, "delete_aspell_config", (void *) &mc_delete_aspell_config))
+         goto error_ret;
+ 
+@@ -312,5 +310,5 @@
+         edit_error_dialog (_("Error"), mc_aspell_error_message (error));
+         mc_delete_aspell_can_have_error (error);
+-        g_free (global_speller);
++        aspell_clean ();
+     }
+ }
+@@ -327,5 +325,10 @@
+         return;
+ 
+-    mc_delete_aspell_speller (global_speller->speller);
++    if (global_speller->speller != NULL)
++        mc_delete_aspell_speller (global_speller->speller);
++
++    if (global_speller->config != NULL)
++        mc_delete_aspell_config (global_speller->config);
++
+     g_free (global_speller);
+     global_speller = NULL;
diff --git a/mc.spec b/mc.spec
index 845050d..dd58dbd 100644
--- a/mc.spec
+++ b/mc.spec
@@ -1,7 +1,7 @@
 Summary:	User-friendly text console file manager and visual shell
 Name:		mc
 Version:	4.8.4
-Release:	3%{?dist}
+Release:	4%{?dist}
 Epoch:		1
 License:	GPLv3+
 Group:		System Environment/Shells
@@ -10,6 +10,8 @@ URL:		http://www.midnight-commander.org/
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:	glib2-devel e2fsprogs-devel slang-devel gpm-devel groff
 BuildRequires:	aspell-devel libssh2-devel >= 1.2.5
+Patch1:		mc-aspell.patch
+Patch2:		mc-altminus.patch
 
 %description
 Midnight Commander is a visual shell much like a file manager, only
@@ -20,6 +22,8 @@ specific files.
 
 %prep
 %setup -q
+%patch1 -p0 -b .spell
+%patch2 -p1 -b .altminus
 
 %build
 export CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $RPM_OPT_FLAGS -Wno-strict-aliasing"
@@ -75,6 +79,10 @@ rm -rf $RPM_BUILD_ROOT
 %dir %{_libexecdir}/mc/ext.d
 
 %changelog
+* Tue Jul 31 2012 Jindrich Novy <jnovy at redhat.com> 4.8.4-4
+- fix segfault if aspell dicts aren't present
+- fix segfault in mcedit when pressing alt-minus
+
 * Fri Jul 27 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:4.8.4-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list