> NetHack feedback form submitted by
> <email deleted> on Friday, June 30, 2006 at 17:31:12
> ---------------------------------------------------------------------------
>
> mailversion:1.35
>
> nhversion:3.4.3
>
> nhfrom:Our 3.4.3 source release, unmodified
> comments:
> telnet nethack.alt.org with the terminal set to 21 rows.
> Choose to pick a char, not accept pot luck, and game segfaults.
> (same happens from linux console)
I was able to reproduce something similar in win32 by setting
the console to 21 rows. As he stated, don't let the game pick you
character for you to reproduce the problem. As soon as I chose
Archeologist the problem occurred:
Where:
In hack.c, weight_cap()
if (Levitation || Is_airlevel(&u.uz) /* <email deleted> */
#ifdef STEED
|| (u.usteed && strongmonst(u.usteed->data))
#endif
)
Variables:
carrcap 200
u.usteed 0x00000000
&u.uz 0x005e54aa
youmonst.data 0x00000000
Examination of the preprocessor output of that section
of code reveals that
"Levitation" becomes:
(u.uprops[47].intrinsic || u.uprops[47].extrinsic ||
((youmonst.data)->mlet == 5))
so it is the is_floater(youmonst.data) causing the crash.
Call stack:
weight_cap() line 2300 + 24 bytes
inv_weight() line 2342 + 5 bytes
calc_capacity(int 0) line 2354 + 5 bytes
near_capacity() line 2365 + 7 bytes
bot() line 607 + 5 bytes
docorner(int 47, int 19) line 2378
erase_menu_or_text(int 5, WinDesc * 0x00a22550, char 0) line 994 + 25 bytes
tty_dismiss_nhwindow(int 5) line 1664 + 15 bytes
tty_select_menu(int 5, int 1, mi * * 0x0006fc40) line 2248 + 9 bytes
tty_player_selection() line 442 + 16 bytes
pcmain(int 3, char * * 0x00a20eb0) line 457
main(int 3, char * * 0x00a20eb0) line 91 + 13 bytes
This adds a check for a valid youmonst.data in
bot().
bypass "wait! there's a creature hidden there" when attacking a hidden monster
sensed by ongoing monster detection
remove makedefs.c dependency that time_t and long are the same size
+terminal window set to 21 lines can cause a crash during player selection
+ menus; have bot() check for valid youmonst.data
Platform- and/or Interface-Specific Fixes
void
bot()
{
- bot1();
- bot2();
+ if (youmonst.data) {
+ bot1();
+ bot2();
+ }
context.botl = context.botlx = 0;
}
static int idx = 0, idx_p, idxmax;
boolean updated = FALSE;
unsigned anytype;
- int i, pc, chg, cap = near_capacity();
+ int i, pc, chg, cap;
struct istat_s *curr, *prev;
boolean valset[MAXBLSTATS];
if (!blinit) panic("bot before init.");
+ if (!youmonst.data) return;
+ cap = near_capacity();
idx_p = idx;
idx = 1 - idx; /* 0 -> 1, 1 -> 0 */