[fvwm] Fix segfaults in FvwmPager

Peter Lemenkov peter at fedoraproject.org
Sun Nov 18 06:58:41 UTC 2012


commit 07e07eed9073ab2904ff0c029cfa7bc484609a69
Author: Peter Lemenkov <lemenkov at gmail.com>
Date:   Sun Nov 18 10:58:23 2012 +0400

    Fix segfaults in FvwmPager
    
    Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>

 fvwm-0001-Change-html-viewer-to-xdg-open.patch     |    6 ++--
 fvwm-0002-Use-mimeopen-instead-of-EDITOR.patch     |    6 ++--
 ...-generate-menus-in-the-Setup-Form-config-.patch |    6 ++--
 ...ncrease-number-of-mouse-buttons-supported.patch |    6 ++--
 ...mPager-be-more-careful-with-window-labels.patch |   29 ++++++++++++++++++++
 fvwm.spec                                          |   19 +++++++++++--
 6 files changed, 57 insertions(+), 15 deletions(-)
---
diff --git a/fvwm-0001-Change-html-viewer-to-xdg-open.patch b/fvwm-0001-Change-html-viewer-to-xdg-open.patch
index 328d2b9..54f4d55 100644
--- a/fvwm-0001-Change-html-viewer-to-xdg-open.patch
+++ b/fvwm-0001-Change-html-viewer-to-xdg-open.patch
@@ -1,10 +1,10 @@
 From e01a29e327d0ec4de33628914f88573e348710da Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta at iki.fi>
 Date: Thu, 19 Apr 2012 23:29:16 +0400
-Subject: [PATCH 1/4] Change html viewer to xdg-open
+Subject: [PATCH 1/5] Change html viewer to xdg-open
 
 ---
- bin/fvwm-menu-headlines.in |    2 +-
+ bin/fvwm-menu-headlines.in | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/bin/fvwm-menu-headlines.in b/bin/fvwm-menu-headlines.in
@@ -21,5 +21,5 @@ index 2a27953..4209b38 100644
  my $icont = '';
  my $iconi = '';
 -- 
-1.7.10
+1.8.0
 
diff --git a/fvwm-0002-Use-mimeopen-instead-of-EDITOR.patch b/fvwm-0002-Use-mimeopen-instead-of-EDITOR.patch
index a7e4745..4b2efe3 100644
--- a/fvwm-0002-Use-mimeopen-instead-of-EDITOR.patch
+++ b/fvwm-0002-Use-mimeopen-instead-of-EDITOR.patch
@@ -1,10 +1,10 @@
 From 5ea8db5a592fa84881fc4f2f9e644915ee93af0f Mon Sep 17 00:00:00 2001
 From: Adam Goode <agoode at fedoraproject.org>
 Date: Thu, 19 Apr 2012 23:31:41 +0400
-Subject: [PATCH 2/4] Use mimeopen instead of EDITOR
+Subject: [PATCH 2/5] Use mimeopen instead of EDITOR
 
 ---
- bin/fvwm-menu-directory.in |    2 +-
+ bin/fvwm-menu-directory.in | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/bin/fvwm-menu-directory.in b/bin/fvwm-menu-directory.in
@@ -21,5 +21,5 @@ index 8e1ff42..038f6b6 100644
  my $commt = undef;
  my $commf = undef;
 -- 
-1.7.10
+1.8.0
 
diff --git a/fvwm-0003-Enable-auto-generate-menus-in-the-Setup-Form-config-.patch b/fvwm-0003-Enable-auto-generate-menus-in-the-Setup-Form-config-.patch
index 9d24818..924a328 100644
--- a/fvwm-0003-Enable-auto-generate-menus-in-the-Setup-Form-config-.patch
+++ b/fvwm-0003-Enable-auto-generate-menus-in-the-Setup-Form-config-.patch
@@ -1,11 +1,11 @@
 From 0d46f79e61d4acdea271a4879b46a46de62c6971 Mon Sep 17 00:00:00 2001
 From: Adam Goode <agoode at fedoraproject.org>
 Date: Thu, 19 Apr 2012 23:34:36 +0400
-Subject: [PATCH 3/4] Enable auto-generate menus in the Setup Form config
+Subject: [PATCH 3/5] Enable auto-generate menus in the Setup Form config
  generator
 
 ---
- fvwm/ConfigFvwmSetup |   15 +--------------
+ fvwm/ConfigFvwmSetup | 15 +--------------
  1 file changed, 1 insertion(+), 14 deletions(-)
 
 diff --git a/fvwm/ConfigFvwmSetup b/fvwm/ConfigFvwmSetup
@@ -42,5 +42,5 @@ index 30d6326..e8226f7 100644
  DestroyMenu MenuFvwmConfig
  AddToMenu MenuFvwmConfig "$[gt.Fvwm Config Ops]" Title
 -- 
-1.7.10
+1.8.0
 
diff --git a/fvwm-0004-Increase-number-of-mouse-buttons-supported.patch b/fvwm-0004-Increase-number-of-mouse-buttons-supported.patch
index d144d7b..2440953 100644
--- a/fvwm-0004-Increase-number-of-mouse-buttons-supported.patch
+++ b/fvwm-0004-Increase-number-of-mouse-buttons-supported.patch
@@ -1,10 +1,10 @@
 From acf766b3a9d695a107f929b3be185015028e7ddb Mon Sep 17 00:00:00 2001
 From: Bill Pemberton <wfp5p at virginia.edu>
 Date: Thu, 19 Apr 2012 23:37:44 +0400
-Subject: [PATCH 4/4] Increase number of mouse buttons supported
+Subject: [PATCH 4/5] Increase number of mouse buttons supported
 
 ---
- libs/defaults.h |    2 +-
+ libs/defaults.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/libs/defaults.h b/libs/defaults.h
@@ -21,5 +21,5 @@ index ad39f8b..ad15994 100644
  #error No more than 31 mouse buttons can be supported on 32 bit platforms
  #endif
 -- 
-1.7.10
+1.8.0
 
diff --git a/fvwm-0005-FvwmPager-be-more-careful-with-window-labels.patch b/fvwm-0005-FvwmPager-be-more-careful-with-window-labels.patch
new file mode 100644
index 0000000..79b7b31
--- /dev/null
+++ b/fvwm-0005-FvwmPager-be-more-careful-with-window-labels.patch
@@ -0,0 +1,29 @@
+From a2b4ed53679cfccc307a98f34cdbf8a279cd6dae Mon Sep 17 00:00:00 2001
+From: Anton Khirnov <anton at khirnov.net>
+Date: Fri, 16 Nov 2012 18:01:13 +0100
+Subject: [PATCH 5/5] FvwmPager: be more careful with window labels.
+
+Do not assume they contain properly encoded strings.
+---
+ modules/FvwmPager/x_pager.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/modules/FvwmPager/x_pager.c b/modules/FvwmPager/x_pager.c
+index a0c3a6f..e56095c 100644
+--- a/modules/FvwmPager/x_pager.c
++++ b/modules/FvwmPager/x_pager.c
+@@ -2775,6 +2775,11 @@ static void label_window_wrap(PagerWindow *t)
+         len   = FlocaleStringNumberOfBytes(FwindowFont, next);
+         width = FlocaleTextWidth(FwindowFont, next, len);
+ 
++        if (end - next < len) {
++          fprintf(stderr, "%s: malformed window label\n", MyName);
++          return;
++        }
++
+         if (width > t->pager_view_width - cur_width - 2*label_border && cur != next)
+           break;
+ 
+-- 
+1.8.0
+
diff --git a/fvwm.spec b/fvwm.spec
index 0b5c97d..cce35b2 100644
--- a/fvwm.spec
+++ b/fvwm.spec
@@ -1,6 +1,6 @@
 Name:		fvwm
 Version:	2.6.5
-Release:	2%{?dist}
+Release:	3%{?dist}
 Summary:	Highly configurable multiple virtual desktop window manager
 
 Group:		User Interface/X
@@ -8,12 +8,22 @@ License:	GPLv2+
 URL:		http://www.fvwm.org/
 Source0:	ftp://ftp.fvwm.org/pub/fvwm/version-2/%{name}-%{version}.tar.bz2
 Source1:	%{name}.desktop
-Source2:	http://www.cl.cam.ac.uk/~pz215/fvwm-scripts/scripts/fvwm-xdg-menu.py
+# Initially taken from http://www.cl.cam.ac.uk/~pz215/fvwm-scripts/scripts/fvwm-xdg-menu.py
+Source2:	fvwm-xdg-menu.py
 
 Patch1:		fvwm-0001-Change-html-viewer-to-xdg-open.patch
 Patch2:		fvwm-0002-Use-mimeopen-instead-of-EDITOR.patch
 Patch3:		fvwm-0003-Enable-auto-generate-menus-in-the-Setup-Form-config-.patch
+# This patch will NEVER be included in the official FVWM and that's why:
+#
+# https://bugs.gentoo.org/show_bug.cgi?id=411811#c7
+# https://github.com/ThomasAdam/fvwm/pull/4#issuecomment-5712410
+#
+# In short - X-servers other than X.org and Xfree86 doesn't support so many
+# mouse buttons so this is a distro-specific patch.
 Patch4:		fvwm-0004-Increase-number-of-mouse-buttons-supported.patch
+# https://github.com/ThomasAdam/fvwm/issues/5
+Patch5:		fvwm-0005-FvwmPager-be-more-careful-with-window-labels.patch
 
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -48,6 +58,7 @@ and implement a virtual desktop.
 %patch2 -p1 -b .mimeopen
 %patch3 -p1 -b .menu-generate
 %patch4 -p1 -b .more-mouse-buttons
+%patch5 -p1 -b .fix_pager
 
 # Filter out false Perl provides
 cat << \EOF > %{name}-prov
@@ -99,7 +110,6 @@ install -D -m0755 -p %{SOURCE2} \
 
 
 %files -f %{name}.lang
-%defattr(-,root,root,-)
 %doc README AUTHORS NEWS ChangeLog COPYING
 %{_bindir}/*
 %{_libexecdir}/%{name}/
@@ -109,6 +119,9 @@ install -D -m0755 -p %{SOURCE2} \
 
 
 %changelog
+* Sun Nov 18 2012 Peter Lemenkov <lemenkov at gmail.com> - 2.6.5-3
+- Fix segfaults in FvwmPager
+
 * Thu Jul 19 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.6.5-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list