fix couple of segfaults (#907045, #912033, #923415)

This commit is contained in:
Jindrich Novy 2013-03-21 11:05:05 +01:00
parent 4872acf871
commit 6a9db2c373
3 changed files with 33 additions and 1 deletions

12
mc-VFSsegfault.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up mc-4.8.7/lib/vfs/direntry.c.VFSsegfault mc-4.8.7/lib/vfs/direntry.c
--- mc-4.8.7/lib/vfs/direntry.c.VFSsegfault 2012-12-27 09:13:20.000000000 +0100
+++ mc-4.8.7/lib/vfs/direntry.c 2013-03-21 10:54:15.344172569 +0100
@@ -656,6 +656,8 @@ vfs_s_close (void *fh)
int res = 0;
struct vfs_class *me = FH_SUPER->me;
+ if (!me) return -1;
+
FH_SUPER->fd_usage--;
if (!FH_SUPER->fd_usage)
vfs_stamp_create (me, FH_SUPER);

12
mc-widgetsegfault.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up mc-4.8.7/lib/widget/widget-common.h.widgetsegfault mc-4.8.7/lib/widget/widget-common.h
--- mc-4.8.7/lib/widget/widget-common.h.widgetsegfault 2012-12-10 22:04:32.000000000 +0100
+++ mc-4.8.7/lib/widget/widget-common.h 2013-03-21 09:38:39.000000000 +0100
@@ -153,7 +153,7 @@ gboolean mouse_global_in_widget (const G
static inline cb_ret_t
send_message (void *w, void *sender, widget_msg_t msg, int parm, void *data)
{
- return WIDGET (w)->callback (WIDGET (w), WIDGET (sender), msg, parm, data);
+ return w ? WIDGET (w)->callback (WIDGET (w), WIDGET (sender), msg, parm, data) : 1;
}
#endif /* MC__WIDGET_INTERNAL_H */

10
mc.spec
View File

@ -1,7 +1,7 @@
Summary: User-friendly text console file manager and visual shell
Name: mc
Version: 4.8.7
Release: 2%{?dist}
Release: 3%{?dist}
Epoch: 1
License: GPLv3+
Group: System Environment/Shells
@ -11,6 +11,8 @@ 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
Patch0: mc-cpiosegfault.patch
Patch1: mc-widgetsegfault.patch
Patch2: mc-VFSsegfault.patch
%description
Midnight Commander is a visual shell much like a file manager, only
@ -22,6 +24,8 @@ specific files.
%prep
%setup -q
%patch0 -p1 -b .cpiosegfault
%patch1 -p1 -b .widgetsegfault
%patch2 -p1 -b .VFSsegfault
%build
export CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $RPM_OPT_FLAGS -Wno-strict-aliasing"
@ -77,6 +81,10 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_libexecdir}/mc/ext.d
%changelog
* Thu Mar 21 2013 Jindrich Novy <jnovy@redhat.com> 4.8.7-3
- attempt to fix segfault while passing messages to widgets (#907045, #912033)
- fix possible segfault when freeing a VFS (#923415)
* Thu Mar 14 2013 Jindrich Novy <jnovy@redhat.com> 4.8.7-2
- fix segfault in cpio VFS while reading corrupted RPM (#921414)