From 69b4f0afc0e1cbb7a5cd618c047897bc4fc258a9 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 8 Apr 2020 14:53:06 -0700 Subject: [PATCH] null pointer crash fix The fix to try to avoid messages about out-of-view objects taking erosion damage made water_damage_chain() vulnerable to dereferencing a null pointer, leading to a crash if you create a pool via wizard mode wishing. --- doc/fixes37.0 | 3 ++- src/trap.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 7717b9402..8de75e918 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.170 $ $NHDT-Date: 1586375530 2020/04/08 19:52:10 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.171 $ $NHDT-Date: 1586382777 2020/04/08 21:52:57 $ General Fixes and Modified Features ----------------------------------- @@ -167,6 +167,7 @@ fix door created into random wall or position opening into solid wall 'use_inverse' option was accidentally made Windows-only; change it back to being more general; change its default to True change inconsistent achievement spelling of "Mine Town" to "Minetown" +fix crash in water_damage_chain X11: was still initializing map to 'stone' instead of 'unexplored' after they became separate glyphs X11: for text map without color, add support for black&white ice; draw it in diff --git a/src/trap.c b/src/trap.c index 948d814d3..d4e9af94d 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 trap.c $NHDT-Date: 1586285683 2020/04/07 18:54:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.357 $ */ +/* NetHack 3.6 trap.c $NHDT-Date: 1586382778 2020/04/08 21:52:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.358 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3682,6 +3682,9 @@ boolean here; struct obj *otmp; xchar x, y; + if (!obj) + return; + /* initialize acid context: so far, neither seen (dknown) potions of acid nor unseen have exploded during this water damage sequence */ g.acid_ctx.dkn_boom = g.acid_ctx.unk_boom = 0;