Your message dated Fri, 07 Dec 2012 03:17:58 +0000
with message-id <[email protected]>
and subject line Bug#695262: fixed in bsdgames-nonfree 2.17-5
has caused the Debian Bug report #695262,
regarding bsdgames-nonfree: Coredump after loading save file
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(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.)


-- 
695262: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695262
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: bsdgames-nonfree
Version: 2.17-4
Severity: normal
Tags: upstream patch

Dear Maintainer,

When running the game, saving and then reloading, I sometimes get a segfault.
I managed to track down the problem.  Rogue's objects use a const char* to
represent damage (e.g. "1d3").  The pointer to this string gets saved in the
savefile, but not the string itself.  When the program is run again, the
pointer is no longer valid, leading to segfaults.

A solution to this is to use a fixed size array of char's (I used char[7]
so that the size remains the same).  Then the whole object will be a simple
POD and serialize correctly.  I have attached a patch (patch -p6 < 
bsdgames.patch).

Note that this will break save files.  But you could argue that they were
already broken ;)

Cheers,
Walter Landry
[email protected]

diff -ru /home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17 
/home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17_patched/
diff -ru /home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17/rogue/init.c 
/home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17_patched/rogue/init.c
--- /home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17/rogue/init.c 
2003-12-16 18:47:37.000000000 -0800
+++ /home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17_patched/rogue/init.c 
2012-12-06 01:28:28.160049621 -0800
@@ -159,7 +159,7 @@
        obj = alloc_object();           /* initial weapons */
        obj->what_is = WEAPON;
        obj->which_kind = MACE;
-       obj->damage = "2d3";
+       strncpy(obj->damage,"2d3",7);
        obj->hit_enchant = obj->d_enchant = 1;
        obj->identified = 1;
        (void) add_to_pack(obj, &rogue.pack, 1);
@@ -168,7 +168,7 @@
        obj = alloc_object();
        obj->what_is = WEAPON;
        obj->which_kind = BOW;
-       obj->damage = "1d2";
+       strncpy(obj->damage,"1d2",7);
        obj->hit_enchant = 1;
        obj->d_enchant = 0;
        obj->identified = 1;
@@ -178,7 +178,7 @@
        obj->what_is = WEAPON;
        obj->which_kind = ARROW;
        obj->quantity = get_rand(25, 35);
-       obj->damage = "1d2";
+       strncpy(obj->damage,"1d2",7);
        obj->hit_enchant = 0;
        obj->d_enchant = 0;
        obj->identified = 1;
diff -ru /home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17/rogue/object.c 
/home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17_patched/rogue/object.c
--- /home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17/rogue/object.c       
2003-12-16 18:47:37.000000000 -0800
+++ 
/home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17_patched/rogue/object.c   
    2012-12-05 23:33:49.596264092 -0800
@@ -536,25 +536,25 @@
        switch(obj->which_kind) {
        case BOW:
        case DART:
-               obj->damage = "1d1";
+          strncpy(obj->damage,"1d1",7);
                break;
        case ARROW:
-               obj->damage = "1d2";
+          strncpy(obj->damage,"1d2",7);
                break;
        case DAGGER:
-               obj->damage = "1d3";
+          strncpy(obj->damage,"1d3",7);
                break;
        case SHURIKEN:
-               obj->damage = "1d4";
+          strncpy(obj->damage,"1d4",7);
                break;
        case MACE:
-               obj->damage = "2d3";
+          strncpy(obj->damage,"2d3",7);
                break;
        case LONG_SWORD:
-               obj->damage = "3d4";
+          strncpy(obj->damage,"3d4",7);
                break;
        case TWO_HANDED_SWORD:
-               obj->damage = "4d5";
+          strncpy(obj->damage,"4d5",7);
                break;
        }
 }
@@ -645,7 +645,7 @@
        obj->picked_up = obj->is_cursed = 0;
        obj->in_use_flags = NOT_USED;
        obj->identified = UNIDENTIFIED;
-       obj->damage = "1d1";
+       strncpy(obj->damage,"1d1",7);
        return(obj);
 }
 
diff -ru /home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17/rogue/rogue.h 
/home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17_patched/rogue/rogue.h
--- /home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17/rogue/rogue.h        
2005-02-15 22:24:50.000000000 -0800
+++ 
/home/boo/random_stuff/roguelike/bsdgames-nonfree-2.17_patched/rogue/rogue.h    
    2012-12-05 23:31:08.344256787 -0800
@@ -219,7 +219,7 @@
 
 struct obj {                           /* comment is monster meaning */
        unsigned long m_flags;  /* monster flags */
-       const char *damage;             /* damage it does */
+       char damage[7];         /* damage it does */
        short quantity;                 /* hit points to kill */
        short ichar;                    /* 'A' is for aquatar */
        short kill_exp;                 /* exp for killing it */



-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.5-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bsdgames-nonfree depends on:
ii  libc6        2.13-37
ii  libncurses5  5.9-10
ii  libtinfo5    5.9-10

bsdgames-nonfree recommends no packages.

Versions of packages bsdgames-nonfree suggests:
pn  bsdgames  <none>

-- no debconf information

--- End Message ---
--- Begin Message ---
Source: bsdgames-nonfree
Source-Version: 2.17-5

We believe that the bug you reported is fixed in the latest version of
bsdgames-nonfree, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Aaron M. Ucko <[email protected]> (supplier of updated bsdgames-nonfree package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Thu, 06 Dec 2012 21:53:01 -0500
Source: bsdgames-nonfree
Binary: bsdgames-nonfree
Architecture: source amd64
Version: 2.17-5
Distribution: unstable
Urgency: high
Maintainer: Aaron M. Ucko <[email protected]>
Changed-By: Aaron M. Ucko <[email protected]>
Description: 
 bsdgames-nonfree - rogue, the classic dungeon exploration game
Closes: 695262
Changes: 
 bsdgames-nonfree (2.17-5) unstable; urgency=high
 .
   * rogue/init.c: Give the initial bow a damage value of 1d1 for
     consistency with object.c; 1d2 was presumably a typo.
   * rogue/{object.c,rogue.h,save.c}: factor an assign_damage function out
     of gr_weapon, and call it from read_pack because saved values (raw
     pointers to string constants) may be invalid.  (The setup was always
     fragile, and broke altogether when 2.17-4 made the executable
     position-independent and subject to loading at randomized addresses.)
     (Closes: #695262.)
Checksums-Sha1: 
 0672e5bfeeb1c4b0483274eb3c255cb76b6665f4 1885 bsdgames-nonfree_2.17-5.dsc
 f9f3b5d4075cde4ff6f979fcd5375341fcef01a0 7867 bsdgames-nonfree_2.17-5.diff.gz
 af6f8cb0770f1ea9871729b81e8fe079b17d40b6 153340 
bsdgames-nonfree_2.17-5_amd64.deb
Checksums-Sha256: 
 38322b9f6d3d5dc6740362dd3d2d3db7805d3f30348afb6798a4e6bb1e3bc20f 1885 
bsdgames-nonfree_2.17-5.dsc
 092df0956db946d7009481e2c309c780e1945df9d88241649b16f108167510b1 7867 
bsdgames-nonfree_2.17-5.diff.gz
 3e72b26e140ab5cc71ec96346d9f44d7dd43d2de2261d54f5986b6441eca18f7 153340 
bsdgames-nonfree_2.17-5_amd64.deb
Files: 
 cee038f43a7785ca5ce87758833466c7 1885 non-free/games optional 
bsdgames-nonfree_2.17-5.dsc
 34036c04470125d5beba07abdf41d097 7867 non-free/games optional 
bsdgames-nonfree_2.17-5.diff.gz
 302e6d0c5e87ee572454256ed12406f5 153340 non-free/games optional 
bsdgames-nonfree_2.17-5_amd64.deb

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

iQIcBAEBCAAGBQJQwVp3AAoJEB5wkbHxSmSirPAP/ikRi7tNLEoYLtn5mjRCLuqv
Yo6NdpnDp5EO5RdZP3Qud7pWuk49062T6oc7B604NxIJ3NNDBIUliZuVMYGCXNBj
vpo4vaaCCLWCybzMwIY8l+Q2SZ9K8BeOmz3Fodd/cUAMMZLj1M7L4cUttM43qpIx
ors4N7CmDdmXF7Ysg/8aUqZzVZCAyXi6eTUqGTJ2lqj6I/lTok8V34urxnnHhVeq
PZLadLXNG9yQg/jfreIOE0SyZorIfjEdoqagS0uHzG9M7J6B9BlMxjK6SUch2Tng
ZxkQIPlyBqhZaqkQwtXSDFAzDdMWQBPYGS36oKj5wULT5IjhMuVpTx4KcEm45HQQ
XPGEc80F8fNaygUeweA0LxYtMO7Xm6o6+I0xwlwdS6JbNzuE5QdRiW/f4TJ3Glk3
1zFDOQnaGhnWeX51g7+cRGYfZIcRXw/KSeVZ4OWWIki1XeJue8xqyAIwz/u3bfan
gGolX+qVIiQSOgJrf4H4QJjo8XbSlrtshLYAqbD1q8FppBPXZ8fneh4/EAj5ypRO
W30lVXryOEZOXWmDVnEQs9uDFujXqXudaTsvnj+oTuy8vTu89QNc7eHXlMlcq+Dd
IRY7Fe2EjvtgHtoCYt3tDp1dPE/uK0ki1w805sNLt5UzxcXA++KTE0sls8EVOETS
8cN2XntIcQ0hBNSKyJMb
=hC/o
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to