-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 06 Jul 2009 15:42:31 -0400, sean finney <[email protected]> wrote:
> jstest.noopt is from compiling the package with DEB_BUILD_OPTS=nostrip,noopt
> 
> unfortunately valgrind is broken on ppc atm so i can't help too much more
> without diving into the source code :(

Thanks for the heads-up! Does the attached patch fix things?

Regards,

Stephen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFKUnSqVNIA9jAyaZsRAiXqAJ9oLYi3DX6cgTSN0M1vu5a+NyPUuQCfQpgL
SP0OEbZhl2q4wQSsoOXBDVU=
=PQym
-----END PGP SIGNATURE-----
Avoid segfaulting if the button map is incorrect.

--- joystick-20051019.orig/utils/jstest.c
+++ joystick-20051019/utils/jstest.c
@@ -117,8 +117,13 @@
 		puts(")");
 
 		printf("and %d buttons (", buttons);
-		for (i = 0; i < buttons; i++)
-			printf("%s%s", i > 0 ? ", " : "", button_names[btnmap[i] - BTN_MISC]);
+		for (i = 0; i < buttons; i++) {
+		  if (btnmap[i] >= BTN_MISC && btnmap[i] <= KEY_MAX) {
+		    printf("%s%s", i > 0 ? ", " : "", button_names[btnmap[i] - BTN_MISC]);
+		  } else {
+		    printf("%s?", i > 0 ? ", " : "");
+		  }
+		}
 		puts(").");
 	}
 

Reply via email to