fix invalid pointer dereference in morguemon

On 3/23/2015 6:41 PM, a bug reporter wrote:
> If the game generates a graveyard, the graveyard places a normal
> demon, but all normal demons are extinct at the time, then morguemon (at
> mkroom.c line 423) indexes mons with NON_PM (the return value of
> ndemon() if it can't find a reference), which is an invalid pointer
> dereference. According to the testbench, this mostly seems to happen on
> dlvl 12.

This fixes the code violation, but the logic will now drop down to the
ghost/wraith/zombie code when that happens.

Is that desireable, or should something else happen (for variety)?
This commit is contained in:
nhmall
2015-03-24 19:20:14 -04:00
parent d787f45dcb
commit a1cc33d6ae
2 changed files with 14 additions and 4 deletions

View File

@@ -880,6 +880,8 @@ message inconsistency: death message "swallowed <mon> whole" was preceded
by "You bite into"
improve the messaging when a monster you can't see is causing an obstruction
add option mention_walls, which gives feedback when bumping against a wall
fix invalid pointer dereference in morguemon if ndemon returns NON_PM
Platform- and/or Interface-Specific Fixes
-----------------------------------------