From 4c8259419396e9a6c9dac5e64adacab0167d42e8 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 29 Dec 2019 16:31:51 +0200 Subject: [PATCH] Fix another out-of-bounds error Monster trying to decide if a tin could cure stoning looking at a special or empty tin would do acidic(&mons[-1]) --- doc/fixes37.0 | 1 + src/muse.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 9383c1ee6..7a40e905e 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -23,6 +23,7 @@ change crysknife from mineral to bone and worm tooth from unspecified to bone worn meat ring shouldn't cause increased hunger; neither should fake Amulet worn +0 ring of protection should cause increased hunger if it is the only source of extrinsic Protection +fix accessing mons[-1] when monster figures out if a tin cures stoning Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/muse.c b/src/muse.c index 25e29ed91..44e711c6e 100644 --- a/src/muse.c +++ b/src/muse.c @@ -2313,6 +2313,8 @@ boolean tinok; if (obj->otyp != CORPSE && (obj->otyp != TIN || !tinok)) return FALSE; /* corpse, or tin that mon can open */ + if (obj->corpsenm == NON_PM) /* empty/special tin */ + return FALSE; return (boolean) (obj->corpsenm == PM_LIZARD || (acidic(&mons[obj->corpsenm]) && (obj->corpsenm != PM_GREEN_SLIME