Home | History | Annotate | Download | only in rogue
History log of /src/games/rogue/object.c
RevisionDateAuthorComments
 1.15  07-Apr-2025  hgutch Fix loading save files

Both monster and weapon damage are represented as strings like "1d1", and
internally the game keeps track of them as pointers to static strings
in memory. When saving, the game saves these pointers and when loading
them the pointers end up being identical to before - which now points to
undefined memory.

So when loading a save game, reset the damage strings based on the type
of monster or weapon.

Pointed out and fix suggested by Anthony C Howe <achowe@snert.com>
(committed with a small modification of said patch).
 1.14  12-Aug-2009  dholland branches: 1.14.56; 1.14.58;
sprinkle static
 1.13  14-Jan-2008  dholland ANSIfy. Remove unnecessary casts. Clean up for -Wsign-compare. Make more
things file-static. Other minor tidyups, and fix a couple minor bugs found
along the way.
 1.12  14-Jan-2008  dholland Whitespace/KNF nits.
 1.11  27-Dec-2007  dholland Comprehensive (or at least extensive) string handling cleanup for rogue.

This patch dates (mostly) back to 2002; the critical parts of it were
handled back then by security-officer. As far as I know, there's
nothing exploitable fixed herein.

A slightly earlier version of this patch was reviewed by Christian Biere
when I filed it as PR 34750.
 1.10  30-Mar-2006  jnemeth branches: 1.10.10;
Coverity CID 993: dereference of NULL pointer
 1.9  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22269, verified by myself.
 1.8  10-Nov-1998  hubertf constify, per PR 6148
 1.7  11-Sep-1998  hubertf fix prototypes, per PR#5867
 1.6  15-Oct-1997  mycroft Better fix for the previous.
 1.5  15-Oct-1997  is make gcc happy on Sparc
 1.4  12-Oct-1997  lukem WARNSify (not an insignificant task...)
 1.3  22-Apr-1995  cgd clean up import, NetBSD RCS Ids
 1.2  01-Aug-1993  mycroft Add RCS identifiers.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  22-Apr-1995  cgd src/games/rogue from Lite
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.10.10.2  23-Mar-2008  matt sync with HEAD
 1.10.10.1  09-Jan-2008  matt sync with HEAD
 1.14.58.1  02-Aug-2025  perseant Sync with HEAD
 1.14.56.1  12-Apr-2025  martin Pull up following revision(s) (requested by hgutch in ticket #1090):

games/rogue/rogue.h: revision 1.25
games/rogue/play.c: revision 1.11
games/rogue/monster.c: revision 1.18
games/rogue/save.c: revision 1.15
games/rogue/object.c: revision 1.15

Fix segfault when canceling "Quit" operation

When pressing 'Q' followed by anything other than 'y', make sure not to
end up calling __unreachable().
Pointed out by Anthony C Howe <achowe%snert.com@localhost>

Fix loading save files

Both monster and weapon damage are represented as strings like "1d1", and
internally the game keeps track of them as pointers to static strings
in memory. When saving, the game saves these pointers and when loading
them the pointers end up being identical to before - which now points to
undefined memory.

So when loading a save game, reset the damage strings based on the type
of monster or weapon.

Pointed out and fix suggested by Anthony C Howe <achowe%snert.com@localhost>
(committed with a small modification of said patch).

RSS XML Feed