Mod_LoadAliasModel: don't corrupt memory if MAXALIASTRIS exceeded

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1625 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Eric Wasylishen 2019-09-12 04:06:55 +00:00
parent 429b29a669
commit 6924a94fa6

View file

@ -2565,13 +2565,16 @@ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
Sys_Error ("model %s has no vertices", mod->name);
if (pheader->numverts > MAXALIASVERTS)
Sys_Error ("model %s has too many vertices", mod->name);
Sys_Error ("model %s has too many vertices (%d; max = %d)", mod->name, pheader->numverts, MAXALIASVERTS);
pheader->numtris = LittleLong (pinmodel->numtris);
if (pheader->numtris <= 0)
Sys_Error ("model %s has no triangles", mod->name);
if (pheader->numtris > MAXALIASTRIS)
Sys_Error ("model %s has too many triangles (%d; max = %d)", mod->name, pheader->numtris, MAXALIASTRIS);
pheader->numframes = LittleLong (pinmodel->numframes);
numframes = pheader->numframes;
if (numframes < 1)