create_particular 'I' vs mkclass

The revised mkclass() [actually new mkclass_aligned()] has an extra
check which didn't used to be there, and attempting to create a
monster of class 'I' with ^G triggered impossible "mkclass found no
class 35 monsters" which the fuzzer escalates to panic.
This commit is contained in:
PatR
2018-12-28 19:10:54 -08:00
parent 5846aee283
commit c4bda6a6a8
2 changed files with 8 additions and 1 deletions

View File

@@ -355,6 +355,8 @@ a config file line with OPTIONS=symset:default, roguesymset:RogueEpyx
avoid potential segfault when doing 'more information' lookup
when built with STATUS_HILITES enabled (the default), gold on status line
was missing '$' prefix for symset:Blank
wizard mode ^G, creating a monster of class 'I' yielded impossible "mkclass
found no class 35 monsters"
tty: turn off an optimization that is the suspected cause of Windows reported
partial status lines following level changes
tty: ensure that current status fields are always copied to prior status

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 read.c $NHDT-Date: 1526728750 2018/05/19 11:19:10 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.155 $ */
/* NetHack 3.6 read.c $NHDT-Date: 1546053040 2018/12/29 03:10:40 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.163 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2490,9 +2490,14 @@ struct _create_particular_data *d;
if (d->which >= LOW_PM)
return TRUE; /* got one */
d->monclass = name_to_monclass(bufp, &d->which);
if (d->which >= LOW_PM) {
d->monclass = MAXMCLASSES; /* matters below */
return TRUE;
} else if (d->monclass == S_invisible) { /* not an actual monster class */
d->which = PM_STALKER;
d->monclass = MAXMCLASSES;
return TRUE;
} else if (d->monclass > 0) {
d->which = urole.malenum; /* reset from NON_PM */
return TRUE;