Chinamming / bullet

Automatically exported from code.google.com/p/bullet
Other
0 stars 0 forks source link

Compound-compound collision algorithm crashes when the shapes have no dynamic AABB tree #763

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a compound shape with btCompoundShape(false), i.e. without a dynamic 
AABB tree.
2. Assign the collision shape to two rigid bodies.
3. Make the rigid bodies collide each other.

What is the expected output? What do you see instead?

When the bug is triggered, Bullet crashes to a NULL pointer dereference in 
btCompoundCompoundCollisionAlgorithm::processCollision. This is because it 
assumes that compound shapes always have a dynamic AABB tree. The assumption is 
false when either of the compound shapes is created by passing 
enableDynamicAabbTree=false to btCompoundShape constructor.

The expected behavior would be to not crash even if the compound shape is 
created with btCompoundShape(false). A somewhat worse option, but still better 
than crashing, would be to remove the option of creating compound shapes 
without the AABB tree.

What version of the product are you using? On what operating system?

Bullet 2.82 in Linux. The bug likely only exists in 2.82. It does not exist in 
Bullet 2.81 or 2.77 at least.

Please provide any additional information below.

Here's the gdb output after the crash:

(gdb) frame 0
#0  btCompoundCompoundCollisionAlgorithm::processCollision 
(this=0x7ffff7f34020, body0Wrap=0x7fffffffdb80, body1Wrap=0x7fffffffdbb0, 
dispatchInfo=..., 
    resultOut=0x7fffffffdb50) at BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp:339
339     MycollideTT(tree0->m_root,tree1->m_root,xform,&callback);
(gdb) list
334 
335     btCompoundCompoundLeafCallback 
callback(col0ObjWrap,col1ObjWrap,this->m_dispatcher,dispatchInfo,resultOut,this-
>m_childCollisionAlgorithmCache,m_sharedManifold);
336 
337 
338     const 
btTransform xform=col0ObjWrap->getWorldTransform().inverse()*col1ObjWrap->getWor
ldTransform();
339     MycollideTT(tree0->m_root,tree1->m_root,xform,&callback);
340 
341     //printf("#compound-compound child/leaf overlap =%d                      
\r",callback.m_numOverlapPairs);
342 
343     //remove non-overlapping child pairs
(gdb) p tree0
$1 = (const btDbvt *) 0x0
(gdb) p tree1
$2 = (const btDbvt *) 0x0

These are the lines from where the NULL pointers come:

const btDbvt* tree0 = compoundShape0->getDynamicAabbTree();
const btDbvt* tree1 = compoundShape1->getDynamicAabbTree();

Original issue reported on code.google.com by ari.must...@gmail.com on 3 Nov 2013 at 1:16

GoogleCodeExporter commented 9 years ago
good points, it needs to be fixed. workaround is trivial: enable tree :)

Original comment by erwin.coumans on 6 Nov 2013 at 6:36

GoogleCodeExporter commented 9 years ago
It should be fixed in latest svn revision, can you please check it?

https://code.google.com/p/bullet/source/detail?r=2715

Original comment by erwin.coumans on 17 Nov 2013 at 8:36