Fix some array out-of-bounds access errors
Add an assert using MAX_DEGENERATE_STATS Fixes Issue 561, thanks to jarno for the report
This commit is contained in:
@@ -621,8 +621,9 @@ void ProcessConvexConcaveSpuCollision(SpuCollisionPairInput* wuInput, CollisionT
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int stats[11]={0,0,0,0,0,0,0,0,0,0,0};
|
#define MAX_DEGENERATE_STATS 15
|
||||||
int degenerateStats[11]={0,0,0,0,0,0,0,0,0,0,0};
|
int stats[MAX_DEGENERATE_STATS]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||||
|
int degenerateStats[MAX_DEGENERATE_STATS]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
@@ -758,8 +759,10 @@ void ProcessSpuConvexConvexCollision(SpuCollisionPairInput* wuInput, CollisionTa
|
|||||||
{
|
{
|
||||||
btGjkPairDetector gjk(shape0Ptr,shape1Ptr,shapeType0,shapeType1,marginA,marginB,&simplexSolver,penetrationSolver);//&vsSolver,penetrationSolver);
|
btGjkPairDetector gjk(shape0Ptr,shape1Ptr,shapeType0,shapeType1,marginA,marginB,&simplexSolver,penetrationSolver);//&vsSolver,penetrationSolver);
|
||||||
gjk.getClosestPoints(cpInput,spuContacts,0);//,debugDraw);
|
gjk.getClosestPoints(cpInput,spuContacts,0);//,debugDraw);
|
||||||
|
|
||||||
|
btAssert(gjk.m_lastUsedMethod <MAX_DEGENERATE_STATS);
|
||||||
stats[gjk.m_lastUsedMethod]++;
|
stats[gjk.m_lastUsedMethod]++;
|
||||||
|
btAssert(gjk.m_degenerateSimplex <MAX_DEGENERATE_STATS);
|
||||||
degenerateStats[gjk.m_degenerateSimplex]++;
|
degenerateStats[gjk.m_degenerateSimplex]++;
|
||||||
|
|
||||||
#ifdef USE_SEPDISTANCE_UTIL
|
#ifdef USE_SEPDISTANCE_UTIL
|
||||||
|
|||||||
@@ -1178,7 +1178,7 @@ btScalar btParallelConstraintSolver::solveGroup(btCollisionObject** bodies1,int
|
|||||||
totalNumRows += info1.m_numConstraintRows;
|
totalNumRows += info1.m_numConstraintRows;
|
||||||
}
|
}
|
||||||
m_tmpSolverNonContactConstraintPool.resize(totalNumRows);
|
m_tmpSolverNonContactConstraintPool.resize(totalNumRows);
|
||||||
offsetSolverConstraints = &m_tmpSolverNonContactConstraintPool[0];
|
offsetSolverConstraints =totalNumRows? &m_tmpSolverNonContactConstraintPool[0]:0;
|
||||||
|
|
||||||
|
|
||||||
///setup the btSolverConstraints
|
///setup the btSolverConstraints
|
||||||
@@ -1303,8 +1303,10 @@ btScalar btParallelConstraintSolver::solveGroup(btCollisionObject** bodies1,int
|
|||||||
pfxSetRigidBodyIdA(pair,idA);
|
pfxSetRigidBodyIdA(pair,idA);
|
||||||
pfxSetRigidBodyIdB(pair,idB);
|
pfxSetRigidBodyIdB(pair,idB);
|
||||||
//is this needed?
|
//is this needed?
|
||||||
pfxSetMotionMaskA(pair,m_memoryCache->m_mystates[idA].getMotionMask());
|
if (idA>=0)
|
||||||
pfxSetMotionMaskB(pair,m_memoryCache->m_mystates[idB].getMotionMask());
|
pfxSetMotionMaskA(pair,m_memoryCache->m_mystates[idA].getMotionMask());
|
||||||
|
if (idB>=0)
|
||||||
|
pfxSetMotionMaskB(pair,m_memoryCache->m_mystates[idB].getMotionMask());
|
||||||
|
|
||||||
pfxSetActive(pair,true);
|
pfxSetActive(pair,true);
|
||||||
int id = currentConstraintRow-offsetSolverConstraints;
|
int id = currentConstraintRow-offsetSolverConstraints;
|
||||||
|
|||||||
Reference in New Issue
Block a user