ref: 19ca52e95404dfbd9feba8ad4c5712caaf3edf7b
parent: 628e1e152b0d683917e4c55c2f5300a2d252edfd
author: Jason Benaim <jkbenaim@gmail.com>
date: Mon Jul 13 21:19:10 EDT 2015
Fix int/pointer union Hexen uses a union of an int and a pointer in specialval_t. There are many places in Hexen where the int is set to 0, and it is assumed that the pointer is then NULL. If the int is smaller than the pointer (e.g. on 64-bit systems, where the int is 32 bits and the pointer is 64), then this can leave a non-NULL pointer to nowhere. This patch ensures that the int and pointer are the same size. This fixes a bug where killing an enemy with the Wraithverge causes a segfault.
--- a/src/hexen/h2def.h
+++ b/src/hexen/h2def.h
@@ -169,7 +169,7 @@
typedef union
{
- int i;
+ intptr_t i;
struct mobj_s *m;
struct player_s *p;
} specialval_t;