fix for using un-initialized stack memory with bullet triangle mesh collisions.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 16 Jan 2011 06:16:28 +0000 (06:16 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 16 Jan 2011 06:16:28 +0000 (06:16 +0000)
the 4th component of the vector is used later when copying the vector.

extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
extern/bullet2/uninitialized_stack_vec.patch [new file with mode: 0644]

index 1fac15387697f70da3896826d0041ee9369bcd6d..203f5b7596cd54e1afeba76d7594ffe8147ed92c 100644 (file)
@@ -61,10 +61,12 @@ void        btScaledBvhTriangleMeshShape::processAllTriangles(btTriangleCallback* callb
        scaledAabbMin[0] = m_localScaling.getX() >= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
        scaledAabbMin[1] = m_localScaling.getY() >= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
        scaledAabbMin[2] = m_localScaling.getZ() >= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
+       scaledAabbMin[3] = 0.0; /* otherwise un-initialized stack memory: uninitialized_stack_vec.patch, blender patch */
        
        scaledAabbMax[0] = m_localScaling.getX() <= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
        scaledAabbMax[1] = m_localScaling.getY() <= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
        scaledAabbMax[2] = m_localScaling.getZ() <= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
+       scaledAabbMax[3] = 0.0; /* otherwise un-initialized stack memory: uninitialized_stack_vec.patch, blender patch */
        
        
        m_bvhTriMeshShape->processAllTriangles(&scaledCallback,scaledAabbMin,scaledAabbMax);
diff --git a/extern/bullet2/uninitialized_stack_vec.patch b/extern/bullet2/uninitialized_stack_vec.patch
new file mode 100644 (file)
index 0000000..96833b7
--- /dev/null
@@ -0,0 +1,17 @@
+Index: src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
+===================================================================
+--- src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp       (revision 34336)
++++ src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp       (working copy)
+@@ -61,10 +61,12 @@
+       scaledAabbMin[0] = m_localScaling.getX() >= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
+       scaledAabbMin[1] = m_localScaling.getY() >= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
+       scaledAabbMin[2] = m_localScaling.getZ() >= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
++      scaledAabbMin[3] = 0.0; /* otherwise un-initialized stack memory: uninitialized_stack_vec.patch, blender patch */
+       
+       scaledAabbMax[0] = m_localScaling.getX() <= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
+       scaledAabbMax[1] = m_localScaling.getY() <= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
+       scaledAabbMax[2] = m_localScaling.getZ() <= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
++      scaledAabbMax[3] = 0.0; /* otherwise un-initialized stack memory: uninitialized_stack_vec.patch, blender patch */
+       
+       
+       m_bvhTriMeshShape->processAllTriangles(&scaledCallback,scaledAabbMin,scaledAabbMax);