From ba7260c1761c2f6846235bbc96650ab4eb728baa Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 21 Apr 2016 10:51:41 +0200 Subject: [PATCH] - fixed overflow issue with large damage values in P_RadiusAttack. --- src/p_map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index f5a19f2695..c89418a32b 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -5178,8 +5178,8 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo } points *= thing->GetClass()->RDFactor; - // points and bombdamage should be the same sign - if (((int(points) * bombdamage) > 0) && P_CheckSight(thing, bombspot, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY)) + // points and bombdamage should be the same sign (the double cast of 'points' is needed to prevent overflows and incorrect values slipping through.) + if ((((double)int(points) * bombdamage) > 0) && P_CheckSight(thing, bombspot, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY)) { // OK to damage; target is in direct path double vz; double thrust;