Ah, so I guess our mails crossed mid-flight...

On Wed, Mar 07, 2007 at 10:06:47PM +0100, Andreas Henriksson wrote:
> > On Tue, 6 Mar 2007, Steve Langasek wrote:
> > > Running acm under valgrind points to a couple bits of uninitialized memory
> > > as the culprits here.  With the attached patch, acm starts up for me and
> > > seems to work properly (or as properly as I guess I can expect without a
> > > joystick).

> I've tried the acm with the suggested patch on my amd64 system.
> Unfortunately it doesn't seem to work for me. It no longer segfaults,
> but all I get is a black screen with a couple of controls (see attached
> partial screenshot, bottom of screen included only).
> This is the same behaviour I get when recompiling (unpatched) acm with
> -O0 instead of -O2.

Ah, apparently I had the advantage of not having any preconceived notions of
how the game was supposed to work, so I pushed buttons until something did
work. :)  FYI, hitting 'r' seems to do the trick; according to the manpage
this is supposed to be 'radar', I don't know why that would be relevant here
but it does do the trick.

Following the manpage directions on how to get started, I manage to crash it
again after trying to set the trim; so here's an updated patch with another
memory initialization fix which didn't seem to matter earlier, but
definitely seems to now... :)

Anyway, there seem to still be some porting issues here, but nothing that
appears to make the package 'unusable' (just 'awkward'), so I'm going to go
ahead and NMU with this patch.  Andreas, if you find any other bugs making
the package unusable, please let me know.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
[EMAIL PROTECTED]                                   http://www.debian.org/
diff -u acm-5.0/src/dis_if.c acm-5.0/src/dis_if.c
--- acm-5.0/src/dis_if.c
+++ acm-5.0/src/dis_if.c
@@ -21,6 +21,8 @@
 
 #include <stdio.h>
 #include <math.h>
+#include <stdlib.h>
+#include <string.h>
 #ifndef WIN32
 #include <sys/time.h>
 #endif
@@ -381,7 +383,7 @@
  *  Allocate storage for the entity table and initialize it.
  */
 
-	entities = (Entity_t *) malloc(sizeof(Entity_t) * MAX_ENTITIES);
+	entities = (Entity_t *) calloc(MAX_ENTITIES, sizeof(Entity_t));
 	for (i = 0; i < MAX_ENTITIES; i++) {
 		entities[i].local = -1;
 	}
@@ -943,6 +945,7 @@
 	dis_pdu   pdu;
 	int       i;
 
+	memset(&pdu,0,sizeof(dis_pdu));
 	if (network_enabled == 0) {
 		return 0;
 	}
diff -u acm-5.0/dis/lib/io.c acm-5.0/dis/lib/io.c
--- acm-5.0/dis/lib/io.c
+++ acm-5.0/dis/lib/io.c
@@ -169,6 +169,8 @@
 	msg.msg_control = (caddr_t) NULL;
 	msg.msg_controllen = 0;
 #endif    
+	msg.msg_flags = 0;
+
 	vec.iov_base = (caddr_t) & buffer;
 	vec.iov_len = len;
 	
diff -u acm-5.0/debian/changelog acm-5.0/debian/changelog
--- acm-5.0/debian/changelog
+++ acm-5.0/debian/changelog
@@ -1,3 +1,12 @@
+acm (5.0-23.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * High-urgency upload for RC bugfix.
+  * Fix several initialization bugs that can trigger crashes on some
+    architectures.  Closes: #413174.
+
+ -- Steve Langasek <[EMAIL PROTECTED]>  Tue,  6 Mar 2007 18:05:34 -0800
+
 acm (5.0-23) unstable; urgency=low
 
   * Applied patch from Petr Salinger to fix FTBFS on GNU/kFreeBSD

Reply via email to