Fix [#23569] Convex hull bounds crash Blender
authorNathan Letwory <nathan@letworyinteractive.com>
Fri, 3 Sep 2010 05:18:36 +0000 (05:18 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Fri, 3 Sep 2010 05:18:36 +0000 (05:18 +0000)
Reported by dobz116

This appears to happen only on 64bit Windows. An issue for this part of code was
reported at http://code.google.com/p/bullet/issues/detail?id=204 and fixed at
http://code.google.com/p/bullet/source/detail?r=1650 . The code change also fixes
the crash we experience: merged changes.

extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp

index 2b06736776769ff4daf7fdc1fc7024c5818243c8..7b45fad12dfd29a6f9f2047b6e66fcd0e5f1ad67 100644 (file)
@@ -24,12 +24,13 @@ btConvexHullShape ::btConvexHullShape (const btScalar* points,int numPoints,int
        m_shapeType = CONVEX_HULL_SHAPE_PROXYTYPE;
        m_unscaledPoints.resize(numPoints);
 
-       unsigned char* pointsBaseAddress = (unsigned char*)points;
+       unsigned char* pointsAddress = (unsigned char*)points;
 
        for (int i=0;i<numPoints;i++)
        {
-               btVector3* point = (btVector3*)(pointsBaseAddress + i*stride);
-               m_unscaledPoints[i] = point[0];
+               btScalar* point = (btScalar*)pointsAddress;
+               m_unscaledPoints[i] = btVector3(point[0], point[1], point[2]);
+               pointsAddress += stride;
        }
 
        recalcLocalAabb();