Impossible instead of segfault in cursed
While fuzz testing, I've seen segfault a handful of times in here, coming from do_takeoff(). Looks like context.takeoff.what is stale, having WORN_BLINDF, but we're not wearing the blindfold anymore. Haven't been able to trace it down yet, so guard it with impossible.
This commit is contained in:
@@ -1484,6 +1484,10 @@ int
|
|||||||
cursed(otmp)
|
cursed(otmp)
|
||||||
register struct obj *otmp;
|
register struct obj *otmp;
|
||||||
{
|
{
|
||||||
|
if (!otmp) {
|
||||||
|
impossible("cursed without otmp");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/* Curses, like chickens, come home to roost. */
|
/* Curses, like chickens, come home to roost. */
|
||||||
if ((otmp == uwep) ? welded(otmp) : (int) otmp->cursed) {
|
if ((otmp == uwep) ? welded(otmp) : (int) otmp->cursed) {
|
||||||
boolean use_plural = (is_boots(otmp) || is_gloves(otmp)
|
boolean use_plural = (is_boots(otmp) || is_gloves(otmp)
|
||||||
|
|||||||
Reference in New Issue
Block a user