r6108 - in packages/trunk/simutrans/debian: . patches
Ansgar Burchardt
ansgar-guest at alioth.debian.org
Sun Mar 16 13:03:57 UTC 2008
Author: ansgar-guest
Date: 2008-03-16 13:03:57 +0000 (Sun, 16 Mar 2008)
New Revision: 6108
Added:
packages/trunk/simutrans/debian/patches/fix-stdarg-calls
Modified:
packages/trunk/simutrans/debian/changelog
packages/trunk/simutrans/debian/patches/series
Log:
* Fix segfault on PowerPC
Modified: packages/trunk/simutrans/debian/changelog
===================================================================
--- packages/trunk/simutrans/debian/changelog 2008-03-16 12:42:59 UTC (rev 6107)
+++ packages/trunk/simutrans/debian/changelog 2008-03-16 13:03:57 UTC (rev 6108)
@@ -1,3 +1,10 @@
+simutrans (99.18~0.svn1664-2) unstable; urgency=low
+
+ * Fix segfault on PowerPC
+ + new patch: fix-stdarg-calls
+
+ -- Ansgar Burchardt <ansgar at 43-1.org> Sun, 16 Mar 2008 14:02:21 +0100
+
simutrans (99.18~0.svn1664-1) unstable; urgency=low
* Initial release (Closes: #437627)
Added: packages/trunk/simutrans/debian/patches/fix-stdarg-calls
===================================================================
--- packages/trunk/simutrans/debian/patches/fix-stdarg-calls (rev 0)
+++ packages/trunk/simutrans/debian/patches/fix-stdarg-calls 2008-03-16 13:03:57 UTC (rev 6108)
@@ -0,0 +1,45 @@
+Do not call v*printf with same va_list argument more than once
+
+utils/cstring_t.cc (cstring_t::vprintf):
+ v*printf is called multiple times with the same va_list argument.
+ This results in undefined behaviour, as va_arg (called by v*printf)
+ may modify the va_list argument.
+
+r1603 broke Simutrans on Linux/PowerPC by fixing another bug, causing
+Simutrans to segfault:
+#0 0x0fbcd820 in strlen () from /lib/libc.so.6
+#1 0x0fb969e4 in vfprintf () from /lib/libc.so.6
+#2 0x0fbb3854 in vsprintf () from /lib/libc.so.6
+#3 0x100efc70 in cstring_t::vprintf (this=0x101ccfe0,
+ format=0x1018b850 "%s/", args=0x7f8aa388) at utils/cstring_t.cc:284
+#4 0x100efe14 in cstring_t::printf (this=<value optimized out>,
+ format=<value optimized out>) at utils/cstring_t.cc:315
+#5 0x1013ad98 in ask_objfilename () at simmain.cc:223
+#6 0x1013c9cc in simu_main (argc=1, argv=0x7f8ab914) at
+ simmain.cc:614
+#7 0x1017a828 in main (argc=1, argv=0x7f8ab914) at simsys_s.c:602
+
+Index: simutrans-99.18~0.svn1664/utils/cstring_t.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/utils/cstring_t.cc
++++ simutrans-99.18~0.svn1664/utils/cstring_t.cc
+@@ -266,6 +266,7 @@
+ {
+ static FILE *nulfp = NULL;
+ int newlen;
++ va_list args2;
+
+ if(!nulfp) {
+ // init once
+@@ -276,7 +277,10 @@
+ #endif
+ }
+ if(nulfp) {
+- newlen = vfprintf(nulfp, format, args);
++ va_copy(args2, args);
++ newlen = vfprintf(nulfp, format, args2);
++ va_end(args2);
++
+ if(buf) {
+ delete [] buf;
+ }
Modified: packages/trunk/simutrans/debian/patches/series
===================================================================
--- packages/trunk/simutrans/debian/patches/series 2008-03-16 12:42:59 UTC (rev 6107)
+++ packages/trunk/simutrans/debian/patches/series 2008-03-16 13:03:57 UTC (rev 6108)
@@ -2,3 +2,4 @@
path-for-game-data.diff
config.diff
gcc-4.3-fixes
+fix-stdarg-calls
More information about the Pkg-games-commits
mailing list