mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-13 07:21:31 +00:00
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:
parent
429b29a669
commit
6924a94fa6
1 changed files with 4 additions and 1 deletions
|
@ -2565,13 +2565,16 @@ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
|
||||||
Sys_Error ("model %s has no vertices", mod->name);
|
Sys_Error ("model %s has no vertices", mod->name);
|
||||||
|
|
||||||
if (pheader->numverts > MAXALIASVERTS)
|
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);
|
pheader->numtris = LittleLong (pinmodel->numtris);
|
||||||
|
|
||||||
if (pheader->numtris <= 0)
|
if (pheader->numtris <= 0)
|
||||||
Sys_Error ("model %s has no triangles", mod->name);
|
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);
|
pheader->numframes = LittleLong (pinmodel->numframes);
|
||||||
numframes = pheader->numframes;
|
numframes = pheader->numframes;
|
||||||
if (numframes < 1)
|
if (numframes < 1)
|
||||||
|
|
Loading…
Reference in a new issue