[net.sources.bugs] core dump in Hack

play@turing.UUCP (01/23/85)

In article <4297@ucbvax.ARPA> grady@ucbvax.ARPA (Steven Grady) writes:
>I got my fdirest core dump from hack
>I was playing as Wizard (not just a wizard, THE wizard) and read
>a scroll of damage weapon while I was confused...
>I haven't checked the source yet, but just thought I'd mention
>it.
>		Steven Grady
>			grady@ucbmiro.Berkeley

Yes, from the source one immediately sees what the problem is:
the codes for ENCHANT_WEAPON and DAMAGE_WEAPON should be exact
analogues, but for some reason the test whether you were wielding
anything got lost under SCR_DAMAGE_WEAPON. Here is the fix.

*** ../Distr_1.0.1/hack.read.c	Mon Jan 21 22:56:19 1985
--- hack.read.c	Wed Jan 23 11:13:35 1985
***************
*** 158,163
  			if(!chwepon(scroll, 1)) return(1);
  		break;
  	case SCR_DAMAGE_WEAPON:
  		if(confused) {
  			pline("Your %s glows purple for a moment.",
  				objects[uwep->otyp].oc_name);

--- 158,167 -----
  			if(!chwepon(scroll, 1)) return(1);
  		break;
  	case SCR_DAMAGE_WEAPON:
+ 		if(!uwep) {
+ 			strange_feeling(scroll);
+ 			return(1);
+ 		}
  		if(confused) {
  			pline("Your %s glows purple for a moment.",
  				objects[uwep->otyp].oc_name);