mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
Added some extra validation.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@697 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
3e9ce35b49
commit
b49714565c
1 changed files with 6 additions and 4 deletions
|
@ -1685,15 +1685,13 @@ void GLMod_LoadTexinfo (lump_t *l)
|
|||
miptex = LittleLong (in->miptex);
|
||||
out->flags = LittleLong (in->flags);
|
||||
|
||||
if (!loadmodel->textures)
|
||||
if (!loadmodel->textures || miptex < 0 || miptex >= loadmodel->numtextures)
|
||||
{
|
||||
out->texture = r_notexture_mip; // checkerboard texture
|
||||
out->flags = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (miptex >= loadmodel->numtextures)
|
||||
Sys_Error ("miptex >= loadmodel->numtextures");
|
||||
out->texture = loadmodel->textures[miptex];
|
||||
if (!out->texture)
|
||||
{
|
||||
|
@ -1772,6 +1770,7 @@ void GLMod_LoadFaces (lump_t *l)
|
|||
msurface_t *out;
|
||||
int i, count, surfnum;
|
||||
int planenum, side;
|
||||
int tn;
|
||||
|
||||
in = (void *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
|
@ -1794,7 +1793,10 @@ void GLMod_LoadFaces (lump_t *l)
|
|||
|
||||
out->plane = loadmodel->planes + planenum;
|
||||
|
||||
out->texinfo = loadmodel->texinfo + LittleShort (in->texinfo);
|
||||
tn = LittleShort (in->texinfo);
|
||||
if (tn < 0 || tn >= loadmodel->numtexinfo)
|
||||
Host_EndGame("Hey! That map has texinfos out of bounds!\n");
|
||||
out->texinfo = loadmodel->texinfo + tn;
|
||||
|
||||
CalcSurfaceExtents (out);
|
||||
|
||||
|
|
Loading…
Reference in a new issue