btConvexHullShape Read Access Violation

leobenaducci
Posts: 3
Joined: Mon Mar 31, 2008 12:05 pm

btConvexHullShape Read Access Violation

Post by leobenaducci »

hi,
i found a bug in btConvexHullShape::btConvexHullShape(const btScalar* points,int numPoints,int stride) when stride is < 16

btConvexHullShape.cpp Ln:31

change this

Code: Select all

btVector3* point = (btVector3*)(pointsBaseAddress + i*stride);
m_unscaledPoints[i] = point[0];
with this

Code: Select all

float* point = (float*)(pointsBaseAddress + i*stride);
btVector3& v = m_unscaledPoints[i];
((float*)v)[0] = *point++;
((float*)v)[1] = *point++;
((float*)v)[2] = *point++;
((float*)v)[3] = 0;
btVector3 operator= tries to read 4 floats from source, if you are using a 12-bytes stride this can crash

bye
Leo Benaducci
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btConvexHullShape Read Access Violation

Post by Erwin Coumans »

Did you make sure to use Bullet 2.75? It should be fixed.

Thanks,
Erwin