[gliv] Fixed segfault (see rhbz #628224)

Peter Lemenkov peter at fedoraproject.org
Mon Aug 30 11:30:40 UTC 2010


commit 65ebc0a686eb1a9b9278fcd40b24741e953bf29a
Author: Peter Lemenkov <lemenkov at gmail.com>
Date:   Mon Aug 30 15:30:32 2010 +0400

    Fixed segfault (see rhbz #628224)
    
    Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>

 .gitignore                                         |    1 +
 ...t-with-NULL-returned-from-get_terminal_ou.patch |   46 +++++++++++++
 gliv.applications                                  |   10 +++
 gliv.desktop                                       |   11 +++
 gliv.spec                                          |   71 +++++++------------
 5 files changed, 94 insertions(+), 45 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 410dd9d..8076ac7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 gliv-1.9.6.tar.bz2
+/gliv-1.9.6.tar.bz2
diff --git a/gliv-0001-Fix-segfault-with-NULL-returned-from-get_terminal_ou.patch b/gliv-0001-Fix-segfault-with-NULL-returned-from-get_terminal_ou.patch
new file mode 100644
index 0000000..d8e443f
--- /dev/null
+++ b/gliv-0001-Fix-segfault-with-NULL-returned-from-get_terminal_ou.patch
@@ -0,0 +1,46 @@
+From c35e38dba8613e5e9d3c2de3b097801d0c418ec6 Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov at gmail.com>
+Date: Mon, 30 Aug 2010 14:48:33 +0400
+Subject: [PATCH] Fix segfault with NULL returned from get_terminal_output.
+ See  RHBZ #628224 for further details and stacktrace:
+
+https://bugzilla.redhat.com/628224
+
+Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
+---
+ src/collection.c |   12 ++++++++----
+ 1 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/src/collection.c b/src/collection.c
+index 5464781..2bdb184 100644
+--- a/src/collection.c
++++ b/src/collection.c
+@@ -634,8 +634,10 @@ gint serialize_collection_nogui(const gchar * filename)
+     }
+ 
+     tty = get_terminal_output();
+-    fprintf(tty, _("Saving collection: %s"), filename_to_utf8(filename));
+-    putc('\n', tty);
++    if (tty != NULL){
++        fprintf(tty, _("Saving collection: %s"), filename_to_utf8(filename));
++	putc('\n', tty);
++    }
+ 
+     res = save_collection(file, &cancel);
+ 
+@@ -1041,8 +1043,10 @@ gint load_dot_gliv(const gchar * filename)
+     loader_t loader;
+ 
+     tty = get_terminal_output();
+-    fprintf(tty, _("Loading collection: %s"), filename_to_utf8(filename));
+-    putc('\n', tty);
++    if (tty != NULL){
++        fprintf(tty, _("Loading collection: %s"), filename_to_utf8(filename));
++	putc('\n', tty);
++    }
+ 
+     loader = get_loader(filename);
+     if (loader == LOADER_DECOMP_DOT_GLIV)
+-- 
+1.7.2.2
+
diff --git a/gliv.applications b/gliv.applications
new file mode 100644
index 0000000..923d863
--- /dev/null
+++ b/gliv.applications
@@ -0,0 +1,10 @@
+gliv
+	command=gliv
+	name=Gliv Image Viewer
+	can_open_multiple_files=true
+	expects_uris=no
+	requires_terminal=false
+	all_gnome_vfs_schemes_supported=yes
+	uses_gnomevfs=true
+	startup_notify=true
+	mime_types=image/gif;image/x-xpm;image/x-xbm;image/jpeg;image/x-bmp;image/png;image/x-tiff;image/x-tga;
diff --git a/gliv.desktop b/gliv.desktop
new file mode 100644
index 0000000..20f8789
--- /dev/null
+++ b/gliv.desktop
@@ -0,0 +1,11 @@
+
+[Desktop Entry]
+Name=Gliv Image Viewer
+Comment=View images fast and smoothly
+Exec=gliv
+Icon=gliv.png
+Terminal=false
+Type=Application
+MimeType=image/gif;image/x-xpm;image/x-xbm;image/jpeg;image/x-bmp;image/png;image/x-tiff;image/x-tga;
+Categories=GNOME;Graphics;
+X-Desktop-File-Install-Version=0.15
diff --git a/gliv.spec b/gliv.spec
index 53a433d..61de77a 100644
--- a/gliv.spec
+++ b/gliv.spec
@@ -1,19 +1,19 @@
-# $Id: gliv.spec,v 1.4 2009/07/25 00:21:40 jkeating Exp $
-# Authority: dag
-# Upstream: Guillaume Chazarain <guichaz$yahoo,fr>
-
 Summary:	Image viewing utility
 Name:		gliv
 Version:	1.9.6
-Release:	5%{?dist}
+Release:	6%{?dist}
 License:	GPLv2+
 Group:		Applications/Multimedia
 URL:		http://guichaz.free.fr/gliv/
-Source:		http://guichaz.free.fr/gliv/files/%{name}-%{version}.tar.bz2
+Source0:	http://guichaz.free.fr/gliv/files/%{name}-%{version}.tar.bz2
+Source1:	gliv.desktop
+Source2:	gliv.applications
+# Patch was sent upstream
+Patch1:		gliv-0001-Fix-segfault-with-NULL-returned-from-get_terminal_ou.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: gtk2-devel >= 2.6.0
-BuildRequires: gtkglext-devel >= 0.7.0
-BuildRequires: desktop-file-utils
+BuildRequires:	gtk2-devel >= 2.6.0
+BuildRequires:	gtkglext-devel >= 0.7.0
+BuildRequires:	desktop-file-utils
 
 %description
 GLiv is an OpenGL image viewer. GLiv is very fast and smooth at rotating,
@@ -21,54 +21,31 @@ panning and zooming if you have an OpenGL accelerated graphics board.
 
 %prep
 %setup -q
-
-%{__cat} <<EOF >gliv.desktop
-[Desktop Entry]
-Name=Gliv Image Viewer
-Comment=View images fast and smoothly
-Exec=gliv
-Icon=gliv.png
-Terminal=false
-Type=Application
-MimeType=image/gif;image/x-xpm;image/x-xbm;image/jpeg;image/x-bmp;image/png;image/x-tiff;image/x-tga;
-Categories=GNOME;Graphics;
-EOF
-
-%{__cat} <<EOF >gliv.applications
-gliv
-	command=gliv
-	name=Gliv Image Viewer
-	can_open_multiple_files=true
-	expects_uris=no
-	requires_terminal=false
-	all_gnome_vfs_schemes_supported=yes
-	uses_gnomevfs=true
-	startup_notify=true
-	mime_types=image/gif;image/x-xpm;image/x-xbm;image/jpeg;image/x-bmp;image/png;image/x-tiff;image/x-tga;
-EOF
+%patch1 -p1 -b .segfault
 
 
 %build
 %configure
-%{__make} %{?_smp_mflags}
+make %{?_smp_mflags}
+
 
 %install
-%{__rm} -rf %{buildroot}
+rm -rf %{buildroot}
 make DESTDIR=%{buildroot} install
 %find_lang %{name}
 
-%{__install} -Dp -m0644 gliv.applications %{buildroot}%{_datadir}/application-registry/gliv.applications
+install -D -p -m 0644 %{SOURCE2}  %{buildroot}%{_datadir}/application-registry/gliv.applications
 
-%{__install} -Dp -m0644 gliv.png %{buildroot}%{_datadir}/pixmaps/gliv.png
+install -D -p -m 0644 gliv.png %{buildroot}%{_datadir}/pixmaps/gliv.png
 
-%{__install} -d -m0755 %{buildroot}%{_datadir}/applications/
+install -d -m0755 %{buildroot}%{_datadir}/applications/
 desktop-file-install \
 	--vendor fedora \
 	--dir %{buildroot}%{_datadir}/applications \
-	gliv.desktop
+	%{SOURCE1}
 
 %clean
-%{__rm} -rf %{buildroot}
+rm -rf %{buildroot}
 
 %post
 update-desktop-database &> /dev/null ||:
@@ -87,6 +64,10 @@ update-desktop-database &> /dev/null ||:
 %{_datadir}/pixmaps/gliv.png
 
 %changelog
+* Mon Aug 30 2010 Peter Lemenkov <lemenkov at gmail.com> - 1.9.6-6
+- Fixed segfault (see rhbz #628224).
+- Cleaned up spec-file a little
+
 * Fri Jul 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.9.6-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
 
@@ -94,18 +75,18 @@ update-desktop-database &> /dev/null ||:
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
 
 
-* Sat Feb  9 2008 Peter Lemenkov <lemenkov at gmail.com> 1.9.6-3
+* Sat Feb  9 2008 Peter Lemenkov <lemenkov at gmail.com> - 1.9.6-3
 - Updated version tag.
 - Rebuild for GCC 4.3
 
-* Wed Nov 22 2006 Peter Lemenkov <lemenkov at gmail.com> 1.9.6-2
+* Wed Nov 22 2006 Peter Lemenkov <lemenkov at gmail.com> - 1.9.6-2
 - Spec cleanup
 
-* Wed Nov 22 2006 Peter Lemenkov <lemenkov at gmail.com> 1.9.6-1
+* Wed Nov 22 2006 Peter Lemenkov <lemenkov at gmail.com> - 1.9.6-1
 - Upgrade to ver. 1.9.6
 - Missing BR added
 
-* Tue Nov 21 2006 Peter Lemenkov <lemenkov at gmail.com> 1.9.5-2
+* Tue Nov 21 2006 Peter Lemenkov <lemenkov at gmail.com> - 1.9.5-2
 - Little cleanups in spec file
 
 * Sun May 28 2006 Adrien BUSTANY <madcat at mymadcat.com> - 1.9.5-1


More information about the scm-commits mailing list