]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
changed way windings are allocated, may fix memory corruption bug on MSVC
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 21 Jan 2002 02:39:08 +0000 (02:39 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 21 Jan 2002 02:39:08 +0000 (02:39 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1372 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c

index dfc3fa02b7a9f95e00e0ddd601000bde8d6134b0..6788f8a15a17203f6a7376e1799161002e1683e6 100644 (file)
@@ -1645,12 +1645,6 @@ typedef struct
 }
 winding_t;
 
 }
 winding_t;
 
-typedef struct
-{
-       int numpoints;
-}
-windingsizeof_t;
-
 /*
 ==================
 NewWinding
 /*
 ==================
 NewWinding
@@ -1664,7 +1658,7 @@ static winding_t *NewWinding (int points)
        if (points > MAX_POINTS_ON_WINDING)
                Host_Error("NewWinding: too many points\n");
 
        if (points > MAX_POINTS_ON_WINDING)
                Host_Error("NewWinding: too many points\n");
 
-       size = sizeof(windingsizeof_t) + sizeof(double[3]) * points;
+       size = sizeof(winding_t) + sizeof(double[3]) * (points - 8);
        w = Mem_Alloc(loadmodel->mempool, size);
        memset (w, 0, size);
 
        w = Mem_Alloc(loadmodel->mempool, size);
        memset (w, 0, size);
 
@@ -2218,6 +2212,7 @@ static void Mod_RecursiveNodePortals (mnode_t *node)
        nodeportal->plane = *node->plane;
 
        nodeportalwinding = BaseWindingForPlane (node->plane);
        nodeportal->plane = *node->plane;
 
        nodeportalwinding = BaseWindingForPlane (node->plane);
+       Mem_CheckSentinels(nodeportalwinding);
        side = 0;       // shut up compiler warning
        for (portal = (portal_t *)node->portals;portal;portal = portal->next[side])
        {
        side = 0;       // shut up compiler warning
        for (portal = (portal_t *)node->portals;portal;portal = portal->next[side])
        {