From c4bda6a6a87c6ec50422d81e74e0158124d67eb7 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 28 Dec 2018 19:10:54 -0800 Subject: [PATCH] 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. --- doc/fixes36.2 | 2 ++ src/read.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index fed918d0f..1a64ce23e 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -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 diff --git a/src/read.c b/src/read.c index f6b2c3092..a52a0317b 100644 --- a/src/read.c +++ b/src/read.c @@ -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; -- 2.40.0