tentative fix for #K3626 - segfault when swallowed

release_hold() checked for (Upolyd && sticks(g.youmonst.data)) before
checking for (u.uswallow) and it could set u.ustuck to Null while
u.uswallow remained set to 1.  dmove_core() was accessing u.ustuck->mx
and u.ustuck->my after that, resulting in a crash.

This fixes that particular case but there might be others that also
assume sticky poly'd hero should be handled before swallowed hero.
Being swallowed/engulfed needs to be handled first.
This commit is contained in:
PatR
2022-06-21 12:52:29 -07:00
parent 3a0c1541dd
commit 27c287997b
4 changed files with 49 additions and 20 deletions

View File

@@ -928,6 +928,12 @@ ball and chain could be accessed after having been freed if bones were saved
early post-3.4.3 tried to fix the "naming artifacts trick" which could be used
to distinguish the type of some undiscovered items, but using a name
that only matched an artifact after capitalization was exploitable
the u.ustuck hierarchy is: swallowed by ustuck, hero poly'd into sticky form
is holding ustuck even if ustuck is sticky, ustuck is holding hero;
but some code assumed that the first two cases were reversed and
could make formerly sticky pold'd hero clear ustuck, leaving hero
swallowed by nothing (u.uswallow==1 with u.ustuck==NULL); that could
cause a crash if u.ustuck got dereferenced
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository