DGoldDragon28 / Unangband

A roguelike originally created (and developed until version 0.6.4c) by Andrew Doull.
https://dgolddragon28.github.io/Unangband/
GNU General Public License v2.0
59 stars 6 forks source link

Crash on melee hit in monster groups #42

Closed dennis-roof closed 6 years ago

dennis-roof commented 6 years ago

Wrong argument order in melee2.c:4398 tell_allies_death causes an occasional crash at melee2.c:4147 tell_allies_info by executing strlen(NULL). This happens to me sometimes when melee fighting groups of monsters as an unarmed warrior in the Bree dungeon levels. With this fix I've cleared multiple dungeons without experiencing crashes.

DGoldDragon28 commented 6 years ago

Examining the relevant code, the argument order is correct (although an awful hack), to allow an indirect call to tell_ally_death(monster_type*,int,int,int) from the called function, without printing anything in the event that the dying monster goes unobserved. There is a null test at line 4147 which guards the only time the value of the third argument is used via a short-circuit operator. I'm not sure what bug you are seeing, but this cannot be it.