shapechanger dropping boulders

Something I noticed while looking over the recent report about hug
attacks.  If a monster carrying one or more boulders (picked up while
in giant form) polymorphs into a non-giant, it will drop them.  If
that happens while it's trapped, it could be killed.  newcham() would
use a stale pointer to continue traversing its inventory after it was
dead and its possessions had been dropped.

I managed to get a chameleon-as-giant carrying boulders and some other
stuff trapped in a bear trap and then transform, but the few attempts
I made never killed off its next form so I wasn't able to induce a
crash to verify that a problem would actually occur.
This commit is contained in:
PatR
2023-04-12 03:03:17 -07:00
parent 8b32ae98e9
commit 9718181322
2 changed files with 18 additions and 5 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1146 $ $NHDT-Date: 1680935652 2023/04/08 06:34:12 $
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1152 $ $NHDT-Date: 1681293789 2023/04/12 10:03:09 $
General Fixes and Modified Features
-----------------------------------
@@ -1135,6 +1135,10 @@ if hero had passes-walls capability and was at the location of a closed door,
attempting to use 'o' on own spot reported "you don't find anything
here to loot"; change to open door for '.' (or '<'), only loot for '>'
items thrown by monster landing on an altar did not show BUC flash
a chameleon in giant form who gets trapped (bear trap?) while carrying
boulders and changes shape could be killed when dropping them;
shape-change traversal of its inventory would continue after it
dropped everything, possibly resulting in a crash
Fixes to 3.7.0-x General Problems Exposed Via git Repository