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:
erwin.coumans
2011-10-24 18:24:31 +00:00
parent a415ef6067
commit 14352169ab
2 changed files with 11 additions and 6 deletions

View File

@@ -1178,7 +1178,7 @@ btScalar btParallelConstraintSolver::solveGroup(btCollisionObject** bodies1,int
totalNumRows += info1.m_numConstraintRows;
}
m_tmpSolverNonContactConstraintPool.resize(totalNumRows);
offsetSolverConstraints = &m_tmpSolverNonContactConstraintPool[0];
offsetSolverConstraints =totalNumRows? &m_tmpSolverNonContactConstraintPool[0]:0;
///setup the btSolverConstraints
@@ -1303,8 +1303,10 @@ btScalar btParallelConstraintSolver::solveGroup(btCollisionObject** bodies1,int
pfxSetRigidBodyIdA(pair,idA);
pfxSetRigidBodyIdB(pair,idB);
//is this needed?
pfxSetMotionMaskA(pair,m_memoryCache->m_mystates[idA].getMotionMask());
pfxSetMotionMaskB(pair,m_memoryCache->m_mystates[idB].getMotionMask());
if (idA>=0)
pfxSetMotionMaskA(pair,m_memoryCache->m_mystates[idA].getMotionMask());
if (idB>=0)
pfxSetMotionMaskB(pair,m_memoryCache->m_mystates[idB].getMotionMask());
pfxSetActive(pair,true);
int id = currentConstraintRow-offsetSolverConstraints;