]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
added vertex bounds checking in Mod_Q1BSP_LoadEdges
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 1 Jan 2006 07:46:13 +0000 (07:46 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 1 Jan 2006 07:46:13 +0000 (07:46 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5881 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c

index a30968237acdf4b2b7bd90cf1da940375923248b..5234c4947aad7385182819a9f73daf1138df1157 100644 (file)
@@ -1758,6 +1758,12 @@ static void Mod_Q1BSP_LoadEdges(lump_t *l)
        {
                out->v[0] = (unsigned short)LittleShort(in->v[0]);
                out->v[1] = (unsigned short)LittleShort(in->v[1]);
+               if (out->v[0] >= loadmodel->brushq1.numvertices || out->v[1] >= loadmodel->brushq1.numvertices)
+               {
+                       Host_Error("Mod_Q1BSP_LoadEdges: %s has invalid vertex indices in edge %i (vertices %i %i >= numvertices %i)\n", loadmodel->name, i, out->v[0], out->v[1], loadmodel->brushq1.numvertices);
+                       out[0] = 0;
+                       out[1] = 0;
+               }
        }
 }