Fix OOM with obviously corrupt miptex lumps (eg: jvoxdm1.bsp).
This commit is contained in:
parent
527233154c
commit
5ed4012a9b
1 changed files with 6 additions and 0 deletions
|
@ -3737,6 +3737,12 @@ TRACE(("dbg: Mod_LoadTextures: inittexturedescs\n"));
|
|||
|
||||
m->nummiptex = LittleLong (m->nummiptex);
|
||||
|
||||
if ((1+m->nummiptex)*sizeof(int) > l->filelen)
|
||||
{
|
||||
Con_Printf(CON_WARNING "warning: %s contains corrupt texture lump\n", loadmodel->name);
|
||||
return false;
|
||||
}
|
||||
|
||||
loadmodel->numtextures = m->nummiptex;
|
||||
loadmodel->textures = ZG_Malloc(&loadmodel->memgroup, m->nummiptex * sizeof(*loadmodel->textures));
|
||||
sizes = alloca(sizeof(*sizes)*m->nummiptex);
|
||||
|
|
Loading…
Reference in a new issue