From 9ed15e5080c058779aa84629a049bdd75fd157fc Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 9 May 2021 20:21:47 +0000 Subject: [PATCH] Fix a possible divide by zero in Mod_PSKMODEL_Load. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13133 d7cf8633-e32d-0410-b094-e92efae38249 --- model_alias.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/model_alias.c b/model_alias.c index b9990beb..11ac0d28 100644 --- a/model_alias.c +++ b/model_alias.c @@ -3073,6 +3073,8 @@ void Mod_PSKMODEL_Load(model_t *mod, void *buffer, void *bufferend) biggestorigin = max(biggestorigin, fabs(k->origin[2])); } loadmodel->num_posescale = biggestorigin / 32767.0f; + if (loadmodel->num_posescale == 0) // don't divide by zero + loadmodel->num_posescale = 1.0; loadmodel->num_poseinvscale = 1.0f / loadmodel->num_posescale; // load the poses from the animkeys @@ -3112,6 +3114,8 @@ void Mod_PSKMODEL_Load(model_t *mod, void *buffer, void *bufferend) biggestorigin = max(biggestorigin, fabs(p->basepose.origin[2])); } loadmodel->num_posescale = biggestorigin / 32767.0f; + if (loadmodel->num_posescale == 0) // don't divide by zero + loadmodel->num_posescale = 1.0; loadmodel->num_poseinvscale = 1.0f / loadmodel->num_posescale; // load the basepose as a frame -- 2.39.2