<Someone> wrote:

> 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().
This commit is contained in:
nethack.allison
2006-07-01 18:44:18 +00:00
parent 2a66234b14
commit 2b8903cd7a
2 changed files with 9 additions and 3 deletions

View File

@@ -238,6 +238,8 @@ use alternate phrasing when life drain attack affects non-living creature
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

View File

@@ -308,8 +308,10 @@ bot2()
void
bot()
{
bot1();
bot2();
if (youmonst.data) {
bot1();
bot2();
}
context.botl = context.botlx = 0;
}
@@ -604,11 +606,13 @@ bot()
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 */