rpms/spacechart/devel spacechart-0.9.5-bounds.patch, NONE, 1.1 spacechart-0.9.5-format.patch, NONE, 1.1 spacechart-0.9.5-open.patch, NONE, 1.1 spacechart.spec, 1.3, 1.4

Lubomir Rintel lkundrak at fedoraproject.org
Mon Apr 6 20:07:48 UTC 2009


Author: lkundrak

Update of /cvs/pkgs/rpms/spacechart/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv29055

Modified Files:
	spacechart.spec 
Added Files:
	spacechart-0.9.5-bounds.patch spacechart-0.9.5-format.patch 
	spacechart-0.9.5-open.patch 
Log Message:
* Mon Apr 6 2009 Lubomir Rintel (Fedora Astronomy) <lkundrak at v3.sk> - 0.9.5-4
- Fix a couple of crashes
- Accept a file to open as command line argument, default to shipped map


spacechart-0.9.5-bounds.patch:

--- NEW FILE spacechart-0.9.5-bounds.patch ---
* 6 + 2 + 2 = 20
* 20 >= 50
* 5 + 1 + 2 = 5

Someone must definitely have sucked at maths and FORTIFY_SOURCE doesn't seem
to be overly impressed with it for some reason.

Lubomir Rintel <lkundrak at v3.sk>

diff -up spacechart-0.9.5/src/star_list_dialog.c.bounds spacechart-0.9.5/src/star_list_dialog.c
--- spacechart-0.9.5/src/star_list_dialog.c.bounds	2009-04-06 17:40:14.000000000 +0200
+++ spacechart-0.9.5/src/star_list_dialog.c	2009-04-06 17:41:25.000000000 +0200
@@ -185,7 +185,7 @@ void cb_append_component( star_component
         star_component_get_bayer_name( comp, bayer_name );
         star_component_get_dm_name( comp, dm );
         star_component_get_spectrum( comp, spectral );
-        snprintf( luminosity, 50, "%6.2f", star_component_get_luminosity(comp) );
+        snprintf( luminosity, sizeof(luminosity), "%6.2f", star_component_get_luminosity(comp) );
         i = gtk_clist_append( GTK_CLIST(data->dialog->clist), row );
         gtk_clist_set_row_data( GTK_CLIST(data->dialog->clist), 
                                 i, data->star );
diff -urp spacechart-0.9.5/src/map.c spacechart-0.9.5.fixed/src/map.c
--- spacechart-0.9.5/src/map.c	2002-06-04 17:49:16.000000000 +0200
+++ spacechart-0.9.5.fixed/src/map.c	2009-04-06 18:09:14.000000000 +0200
@@ -265,7 +265,7 @@ void draw_link( link_t* link, double x1,
         GdkLineStyle style;
         double rgb[3];
         double distance, x, y;
-        char label[5];
+        char label[8];
         distance_unit_t unit;
 
         settings_find_link_draw( map->settings, link, &width, &style, rgb );
@@ -275,7 +275,7 @@ void draw_link( link_t* link, double x1,
         {
                 distance = link_get_distance( link );
                 unit = settings_get_distance_unit( map->settings );
-                sprintf( label, "%5.1f", (unit==DISTANCE_PARSECS) ? distance : 
+                snprintf( label, sizeof(label), "%5.1f", (unit==DISTANCE_PARSECS) ? distance : 
                          distance*PARSEC_TO_LY );
                 x = (x1+x2)/2;
                 y = (y1+y2)/2;

spacechart-0.9.5-format.patch:

--- NEW FILE spacechart-0.9.5-format.patch ---
Don't hurt user's feelings by crashing on attempts to load a complete junk.
Maybe he didn't mean it and you'd regret it one day.

Lubomir Rintel <lkundrak at v3.sk>

diff -up spacechart-0.9.5/src/star_catalog.c.format spacechart-0.9.5/src/star_catalog.c
--- spacechart-0.9.5/src/star_catalog.c.format	2009-04-06 17:47:13.000000000 +0200
+++ spacechart-0.9.5/src/star_catalog.c	2009-04-06 17:54:35.000000000 +0200
@@ -95,7 +95,7 @@ int star_catalog_read( star_catalog_t* c
                 /* Before reading the stars we read the header. It is supposed
                  * to contain data the user should know */
                 old_length = 0;
-                while(  (fgets( tmp, 256, data_file )[0]) &&
+                while(  fgets( tmp, 256, data_file ) &&
                        tmp[0] != '%' )
                 {
                         length = strlen(tmp);
@@ -116,6 +116,12 @@ int star_catalog_read( star_catalog_t* c
                 }
                 catalog->filename = basename(file);
 
+                if( feof( data_file ) )
+                {
+                        /* No header end found yet and we've encountered EOF */
+                        error = 2;
+                }
+
                 while( !error )
                 {
                         star = star_new();

spacechart-0.9.5-open.patch:

--- NEW FILE spacechart-0.9.5-open.patch ---
Accept map file name as argument.
Default to shipped star map for improved FTUE.

Lubomir Rintel <lkundrak at v3.sk>

diff -urp spacechart-0.9.5/src/main.c spacechart-0.9.5.fixed/src/main.c
--- spacechart-0.9.5/src/main.c	2002-11-24 19:18:54.000000000 +0100
+++ spacechart-0.9.5.fixed/src/main.c	2009-04-06 18:36:52.000000000 +0200
@@ -59,6 +59,11 @@ int main( int argc, char** argv ) 
 
         gtk_init_add (settings_enable_callbacks, settings);
 
+	if ( argc > 1 )
+		settings_set_catalog_filename(settings, (char *)(argv[1]) );
+	else
+		settings_set_catalog_filename(settings, DATADIR "hip30.dat" );
+
         /* Here we go... */
         gtk_main();
 


Index: spacechart.spec
===================================================================
RCS file: /cvs/pkgs/rpms/spacechart/devel/spacechart.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- spacechart.spec	24 Mar 2009 16:03:12 -0000	1.3
+++ spacechart.spec	6 Apr 2009 20:07:18 -0000	1.4
@@ -1,6 +1,6 @@
 Name:		spacechart
 Version:	0.9.5
-Release:	3%{?dist}
+Release:	4%{?dist}
 Summary:	A 3D star-mapping program
 
 Group:		Applications/Engineering
@@ -12,6 +12,9 @@
 # From Debian:
 # http://ftp.debian.org/debian/pool/main/s/spacechart/spacechart_0.9.5-13.diff.gz
 Source3:	spacechart.1
+Patch0:         spacechart-0.9.5-bounds.patch
+Patch1:         spacechart-0.9.5-format.patch
+Patch2:         spacechart-0.9.5-open.patch
 
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:	flex, gnome-libs-devel, desktop-file-utils
@@ -25,6 +28,9 @@
 
 %prep
 %setup -q
+%patch0 -p1 -b .bounds
+%patch1 -p1 -b .format
+%patch2 -p1 -b .open
 
 %build
 %configure
@@ -53,6 +59,10 @@
 %{_datadir}/applications/fedora-%{name}.desktop
 
 %changelog
+* Mon Apr 6 2009 Lubomir Rintel (Fedora Astronomy) <lkundrak at v3.sk> - 0.9.5-4
+- Fix a couple of crashes
+- Accept a file to open as command line argument, default to shipped map
+
 * Tue Mar 24 2009 Lubomir Rintel (Fedora Astronomy) <lkundrak at v3.sk> - 0.9.5-3
 - Add icon
 - Add manual page




More information about the fedora-extras-commits mailing list