From 839143550fb10a35ecabe64b235f6d1cee2cb71a Mon Sep 17 00:00:00 2001 From: fgsfds Date: Tue, 13 Feb 2024 01:16:57 +0100 Subject: [PATCH] port: fix potential crash in handInflictMeleeDamage pointers can be little endian, so there might be a problem --- src/game/prop.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/game/prop.c b/src/game/prop.c index 786a64db1..92505fa3a 100644 --- a/src/game/prop.c +++ b/src/game/prop.c @@ -1170,7 +1170,11 @@ void handInflictMeleeDamage(s32 handnum, struct gset *gset, bool arg2) bool isglass = false; if (obj && gset->weaponnum != WEAPON_TRANQUILIZER) { - isglass = obj->type == OBJTYPE_GLASS || obj->type == OBJTYPE_TINTEDGLASS; + isglass = +#ifdef AVOID_UB + (prop->type == PROPTYPE_OBJ) && +#endif + (obj->type == OBJTYPE_GLASS || obj->type == OBJTYPE_TINTEDGLASS); } if (arg2) {