fuzzball-muck/fuzzball

Recycling object in force loop crashes (SF issue)

Opened this issue · 0 comments

Forcing a thing to execute an action that recycles it
in the process will crash. Fuzzball seems to try to
set an internal property on the object when it no
longer exists. GDB backtrace:

#0 0x400ac2e1 in kill () from /lib/libc.so.6
#1 0x400abf15 in raise () from /lib/libc.so.6
#2 0x400ad6fb in abort () from /lib/libc.so.6
#3 0x0806abd3 in panic (message=0xbfff2784 "BAILOUT:
caught signal 11")
at game.c:260
#4 0x081292d5 in bailout (sig=11) at signal.c:208
#5 <signal handler called>
#6 0x08077090 in interp_loop (player=17, program=16,
fr=0x81e3e50, rettyp=0)
at interp.c:1711
#7 0x0809b54c in trigger (descr=-1, player=17, exit=5,
pflag=1) at move.c:546
#8 0x0809b7f2 in do_move (descr=-1, player=17,
direction=0xbfffa2ac "@recme",
lev=0) at move.c:597
#9 0x0806b98b in process_command (descr=-1, player=17,
command=0xbfffa2ac "@recme") at game.c:567
#10 0x08136088 in do_force (descr=9, player=2,
what=0xbfffa2a5 "random",
command=0xbfffa2ac "@recme") at wiz.c:408
#11 0x0806c585 in process_command (descr=9, player=2,
command=0xbfffa2a0 "@for") at game.c:838
#12 0x0813daae in do_command (d=0x81e3918,
command=0xbfffd2e0 "@for random=@recme") at
interface.c:2308
#13 0x0813d3d2 in process_commands () at interface.c:2191
#14 0x0813af6d in shovechars () at interface.c:1089
#15 0x08139983 in main (argc=8, argv=0xbffff584) at
interface.c:561

....

I've commited a temporary fix to prevent the crash, however
the true fix would be to allow muf programs to run with invalid
users...

....

The steps are:
PLAYER_SET_BLOCK(player, 0); -->
PLAYER_SP((player)->block=0);
DBFETCH(player)->sp.player.sp->block=0)

The full fix would be to do (player->sp? ..code.. : ); on
everything that touches the player.sp. (Then again,
everything that accesses the sp fields should check that
it's non-null before proceeding.)

This will be mitigated by the fact that all of these will be
functions when db4 is integrated.