From: havoc Date: Sun, 9 May 2021 20:21:47 +0000 (+0000) Subject: Fix a possible divide by zero in Mod_PSKMODEL_Load. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9ed15e5080c058779aa84629a049bdd75fd157fc;p=xonotic%2Fdarkplaces.git 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 --- 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