1
0
Fork 0
forked from fte/fteqw

Added code to check for truncated BSPs.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2398 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-10-05 21:12:04 +00:00
parent 59d86d9c58
commit 742c8df40b
3 changed files with 30 additions and 13 deletions

View file

@ -2611,23 +2611,18 @@ qboolean GLMod_LoadBrushModel (model_t *mod, void *buffer)
for (i=0 ; i<sizeof(dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
if (1)//mod_ebfs.value)
{
char *id;
id = (char *)(header + 1);
if (id[0]=='P' && id[1]=='A' && id[2]=='C' && id[3]=='K')
{ //EBFS detected.
COM_LoadMapPackFile(mod->name, sizeof(dheader_t));
}
}
// checksum all of the map, except for entities
mod->checksum = 0;
mod->checksum2 = 0;
for (i = 0; i < HEADER_LUMPS; i++) {
for (i = 0; i < HEADER_LUMPS; i++)
{
if ((unsigned)header->lumps[i].fileofs + (unsigned)header->lumps[i].filelen > com_filesize)
{
Con_Printf (S_ERROR "Mod_LoadBrushModel: %s appears truncated\n", mod->name);
return false;
}
if (i == LUMP_ENTITIES)
continue;
chksum = Com_BlockChecksum(mod_base + header->lumps[i].fileofs, header->lumps[i].filelen);
@ -2637,6 +2632,16 @@ qboolean GLMod_LoadBrushModel (model_t *mod, void *buffer)
continue;
mod->checksum2 ^= chksum;
}
if (1)//mod_ebfs.value)
{
char *id;
id = (char *)(header + 1);
if (id[0]=='P' && id[1]=='A' && id[2]=='C' && id[3]=='K')
{ //EBFS detected.
COM_LoadMapPackFile(mod->name, sizeof(dheader_t));
}
}
noerrors = true;

View file

@ -1512,6 +1512,12 @@ qboolean Mod_LoadBrushModel (model_t *mod, void *buffer)
// checksum all of the map, except for entities
for (i = 0; i < HEADER_LUMPS; i++)
{
if ((unsigned)header->lumps[i].fileofs + (unsigned)header->lumps[i].filelen > com_filesize)
{
Con_Printf (S_ERROR "Mod_LoadBrushModel: %s appears truncated\n", mod->name);
return false;
}
if (i == LUMP_ENTITIES)
continue;
chksum = Com_BlockChecksum(mod_base + header->lumps[i].fileofs,

View file

@ -2015,7 +2015,13 @@ qboolean SWMod_LoadBrushModel (model_t *mod, void *buffer)
mod->checksum2 = 0;
// checksum all of the map, except for entities
for (i = 0; i < HEADER_LUMPS; i++) {
for (i = 0; i < HEADER_LUMPS; i++)
{
if ((unsigned)header->lumps[i].fileofs + (unsigned)header->lumps[i].filelen > com_filesize)
{
Con_Printf (S_ERROR "Mod_LoadBrushModel: %s appears truncated\n", mod->name);
return false;
}
if (i == LUMP_ENTITIES)
continue;
mod->checksum ^= Com_BlockChecksum(mod_base + header->lumps[i].fileofs,