Your message dated Fri, 25 Apr 2008 15:43:52 -0400
with message-id <[EMAIL PROTECTED]>
has caused the   report #477768,
regarding adventure: segfaults when saving
to be marked as having been forwarded to the upstream software
author(s) [EMAIL PROTECTED]

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)


-- 
477768: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477768
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
It fails on amd64 and probably other 64 bit architectures because
adventure's crc code does some bit banging that makes assumptions about
data type sizes. In particular, it assumes that a long is 32 bits wide,
here:

                        if (!(i = crcval >> 24 ^ *p)) {

The right value for a 64 bit arch would be, I think, 56. (And with that
change the crash is vanquished on amd64.) John, the attached patch seems
to work, but bit banging is not exactly my specialty, and I'm not sure
if it will generate the same crcs on 64 bit systems as would be
generated on 32 bit.

Peter De Wachter wrote:
> Package: bsdgames
> Version: 2.17-14
> Severity: important
> 
> Welcome to Adventure!!  Would you like instructions?
> > no
> 
> You are standing at the end of a road before a small brick building.
> Around you is a forest.  A small stream flows out of the building and
> down a gully.
> > save
> I can suspend your adventure for you so you can resume later, but
> you will have to wait at least 45 minutes before continuing.
> Is this acceptable?
> > yes
> 
> OK
> What would you like to call the saved version?
> > adventure.save
> Segmentation fault
> 
> 
> -- System Information:
> Debian Release: lenny/sid
>   APT prefers unstable
>   APT policy: (500, 'unstable'), (1, 'experimental')
> Architecture: amd64 (x86_64)
> 
> Kernel: Linux 2.6.24-1-amd64 (SMP w/1 CPU core)
> Locale: LANG=nl_BE.UTF-8, LC_CTYPE=nl_BE.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> 
> Versions of packages bsdgames depends on:
> ii  libc6                     2.7-10         GNU C Library: Shared libraries
> ii  libgcc1                   1:4.3.0-3      GCC support library
> ii  libncurses5               5.6+20080419-1 Shared libraries for terminal 
> hand
> ii  libstdc++6                4.3.0-3        The GNU Standard C++ Library v3
> ii  wamerican [wordlist]      6-2.1          American English dictionary 
> words 
> ii  wdutch [wordlist]         1:1.00-2       list of Dutch words
> 
> bsdgames recommends no packages.
> 
> -- no debconf information
> 
> 

-- 
see shy jo
commit 40ab45f59834317a4b2c67840530dfa10cc94529
Author: Joey Hess <[EMAIL PROTECTED]>
Date:   Fri Apr 25 15:41:54 2008 -0400

    adventure: Fix crc code to not segfault on 64 bit architectures. Closes: #477768

diff --git a/adventure/crc.c b/adventure/crc.c
index 66504f1..c6ee5f1 100644
--- a/adventure/crc.c
+++ b/adventure/crc.c
@@ -42,6 +42,8 @@ __RCSID("$NetBSD: crc.c,v 1.8 2003/08/07 09:36:50 agc Exp $");
 #endif
 #endif /* not lint */
 
+#include <limits.h>
+
 #include "extern.h"
 
 const unsigned long crctab[] = {
@@ -125,7 +127,7 @@ crc(ptr, nr)		/* Process nr bytes at a time; ptr points to them */
 
 	while (nr > 0)
 		for (p = ptr; nr--; ++p) {
-			if (!(i = crcval >> 24 ^ *p)) {
+			if (!(i = crcval >> (sizeof(crcval) * CHAR_BIT - 8) ^ *p)) {
 				i = step++;
 				if (step >= sizeof(crctab) / sizeof(crctab[0]))
 					step = 0;
diff --git a/debian/changelog b/debian/changelog
index 28b511b..479afa7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
 bsdgames (2.17-15) UNRELEASED; urgency=low
 
   * Include rot13 in package description. Closes: #477141
+  * adventure: Fix crc code to not segfault on 64 bit architectures.
+    Closes: #477768
 
  -- Joey Hess <[EMAIL PROTECTED]>  Mon, 21 Apr 2008 12:37:44 -0400
 

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Reply via email to