From 5c5567a161b252e0d8e6c830d1b0761041a2fedc Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Dec 12 2007 19:34:13 +0000 Subject: - Fix xfig crashing when zooming in a lot (bz 420411) --- diff --git a/xfig-3.2.5-zoom-crash.patch b/xfig-3.2.5-zoom-crash.patch new file mode 100644 index 0000000..49bfbcd --- /dev/null +++ b/xfig-3.2.5-zoom-crash.patch @@ -0,0 +1,60 @@ +diff -up xfig.3.2.5/w_rulers.c~ xfig.3.2.5/w_rulers.c +--- xfig.3.2.5/w_rulers.c~ 2007-12-12 20:28:30.000000000 +0100 ++++ xfig.3.2.5/w_rulers.c 2007-12-12 20:28:30.000000000 +0100 +@@ -1166,7 +1166,7 @@ void reset_topruler(void) + register int i,k; + register tick_info* tk; + register Pixmap p = topruler_pm; +- char number[6]; ++ char number[16]; + int X0,len; + int tickmod, tickskip; + +@@ -1183,7 +1183,7 @@ void reset_topruler(void) + tickmod = 1; + + /* see how big a label is to adjust spacing, if necessary */ +- sprintf(number, "%d%s", (X0+(int)((TOPRULER_WD/zoomscale)))/tickmod, cur_fig_units); ++ snprintf(number, sizeof(number), "%d%s", (X0+(int)((TOPRULER_WD/zoomscale)))/tickmod, cur_fig_units); + len = XTextWidth(roman_font, number, strlen(number)); + while (skipx < (len + 5)/zoomscale) { + skip *= 2; +@@ -1197,11 +1197,11 @@ void reset_topruler(void) + /* string */ + if (i % skipx == 0) { + if ((i/10) % tickmod == 0) +- sprintf(number, "%d%s", i/tickmod, cur_fig_units); ++ snprintf(number, sizeof(number), "%d%s", i/tickmod, cur_fig_units); + else if (i % tickmod == 0) +- sprintf(number, "%d", i/tickmod); ++ snprintf(number, sizeof(number), "%d", i/tickmod); + else +- sprintf(number, precstr, (float)(1.0 * i / tickmod)); ++ snprintf(number, sizeof(number), precstr, (float)(1.0 * i / tickmod)); + /* get length of string to position it */ + len = XTextWidth(roman_font, number, strlen(number)); + /* we center on the number only, letting the minus sign hang out */ +@@ -1425,7 +1425,7 @@ void reset_sideruler(void) + register int i,k; + register tick_info* tk; + register Pixmap p = sideruler_pm; +- char number[6],len; ++ char number[16],len; + int Y0; + int tickmod, tickskip; + +@@ -1456,11 +1456,11 @@ void reset_sideruler(void) + /* string */ + if (i % skipx == 0) { + if ((i/10) % tickmod == 0) +- sprintf(number, "%d%s", i/tickmod, cur_fig_units); ++ snprintf(number, sizeof(number), "%d%s", i/tickmod, cur_fig_units); + else if (i % tickmod == 0) +- sprintf(number, "%d", i/tickmod); ++ snprintf(number, sizeof(number), "%d", i/tickmod); + else +- sprintf(number, precstr, (float)(1.0 * i / tickmod)); ++ snprintf(number, sizeof(number), precstr, (float)(1.0 * i / tickmod)); + /* get length of string to position it */ + len = XTextWidth(roman_font, number, strlen(number)); + /* vertically centered on inch/cm mark */ diff --git a/xfig.spec b/xfig.spec index cf3a60a..b83f197 100644 --- a/xfig.spec +++ b/xfig.spec @@ -3,7 +3,7 @@ Summary: An X Window System tool for drawing basic vector graphics Name: xfig Version: 3.2.5 -Release: 6%{?dist} +Release: 7%{?dist} License: MIT Group: Applications/Multimedia URL: http://www.xfig.org/ @@ -21,6 +21,7 @@ Patch10: xfig-3.2.5-enable-Xaw3d.patch Patch11: xfig-3.2.5-color-resources.patch Patch12: xfig-3.2.5-quiet.patch Patch13: xfig-3.2.5-urwfonts.patch +Patch14: xfig-3.2.5-zoom-crash.patch BuildRequires: libjpeg-devel BuildRequires: libpng-devel @@ -93,6 +94,7 @@ Files common to both the plain Xaw and the Xaw3d version of xfig. %patch11 -p1 -b .color-resources %patch12 -p1 -b .quiet %patch13 -p1 -b .urw +%patch14 -p1 -b .zoom-crash ln -nfs Doc/xfig.man xfig.man find -type f -print0 | xargs -0 chmod -x rm `find Doc -name '*.orig'` Doc/html/*.save Doc/html/images/sav1a0.tmp @@ -180,6 +182,9 @@ fi %changelog +* Wed Dec 12 2007 Hans de Goede 3.2.5-7 +- Fix xfig crashing when zooming in a lot (bz 420411) + * Sat Nov 17 2007 Hans de Goede 3.2.5-6 - Put the Xaw3d version in the main xfig package, put the plain Xaw version in a -plain subpackage