-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.347 $ $NHDT-Date: 1604619327 2020/11/05 23:35:27 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.348 $ $NHDT-Date: 1604620981 2020/11/06 00:03:01 $
General Fixes and Modified Features
-----------------------------------
fix off-by-one bug in dimensions of theme rooms
fire/frost horn feedback when zapped by monster was inaccurate (falsely
claimed that it was "directed at self" when attacking hero)
+tins of spinach and 'dead' eggs could cause out of array bounds access
+ attempting to index into mons[] by polyfodder() macro
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support
-/* NetHack 3.7 obj.h $NHDT-Date: 1604442292 2020/11/03 22:24:52 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.78 $ */
+/* NetHack 3.7 obj.h $NHDT-Date: 1604620981 2020/11/06 00:03:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.79 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
#define stale_egg(egg) \
((g.monstermoves - (egg)->age) > (2 * MAX_EGG_HATCH_TIME))
#define ofood(o) ((o)->otyp == CORPSE || (o)->otyp == EGG || (o)->otyp == TIN)
+ /* note: sometimes eggs and tins have special corpsenm values that
+ shouldn't be used as an index into mons[] */
#define polyfodder(obj) \
- (ofood(obj) && (pm_to_cham((obj)->corpsenm) != NON_PM \
+ (ofood(obj) && (obj)->corpsenm >= LOW_PM \
+ && (pm_to_cham((obj)->corpsenm) != NON_PM \
|| dmgtype(&mons[(obj)->corpsenm], AD_POLY)))
#define mlevelgain(obj) (ofood(obj) && (obj)->corpsenm == PM_WRAITH)
#define mhealup(obj) (ofood(obj) && (obj)->corpsenm == PM_NURSE)
-#define Is_pudding(o) \
- (o->otyp == GLOB_OF_GRAY_OOZE || o->otyp == GLOB_OF_BROWN_PUDDING \
+#define Is_pudding(o) \
+ (o->otyp == GLOB_OF_GRAY_OOZE || o->otyp == GLOB_OF_BROWN_PUDDING \
|| o->otyp == GLOB_OF_GREEN_SLIME || o->otyp == GLOB_OF_BLACK_PUDDING)
/* Containers */