From 9ffb05eb3bdea7944b74fadf62d8096d63c91bf6 Mon Sep 17 00:00:00 2001 From: erwincoumans Date: Mon, 15 Jan 2018 11:59:00 -0800 Subject: [PATCH] fix double->float issue by cast, fixes issue #1510 fix possible out-of-bounds access in btMultiBody --- examples/SharedMemory/PhysicsServerExample.cpp | 8 ++++---- src/BulletDynamics/Featherstone/btMultiBody.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/SharedMemory/PhysicsServerExample.cpp b/examples/SharedMemory/PhysicsServerExample.cpp index 708cad3ae..639fc546e 100644 --- a/examples/SharedMemory/PhysicsServerExample.cpp +++ b/examples/SharedMemory/PhysicsServerExample.cpp @@ -2533,10 +2533,10 @@ void PhysicsServerExample::drawUserDebugLines() optionFlag |= CommonGraphicsApp::eDrawText3D_OrtogonalFaceCamera; } else { - orientation[0] = m_multiThreadedHelper->m_userDebugText[i].m_textOrientation[0]; - orientation[1] = m_multiThreadedHelper->m_userDebugText[i].m_textOrientation[1]; - orientation[2] = m_multiThreadedHelper->m_userDebugText[i].m_textOrientation[2]; - orientation[3] = m_multiThreadedHelper->m_userDebugText[i].m_textOrientation[3]; + orientation[0] = (float)m_multiThreadedHelper->m_userDebugText[i].m_textOrientation[0]; + orientation[1] = (float)m_multiThreadedHelper->m_userDebugText[i].m_textOrientation[1]; + orientation[2] = (float)m_multiThreadedHelper->m_userDebugText[i].m_textOrientation[2]; + orientation[3] = (float)m_multiThreadedHelper->m_userDebugText[i].m_textOrientation[3]; optionFlag |= CommonGraphicsApp::eDrawText3D_TrueType; } diff --git a/src/BulletDynamics/Featherstone/btMultiBody.cpp b/src/BulletDynamics/Featherstone/btMultiBody.cpp index 6571822c9..578814c36 100644 --- a/src/BulletDynamics/Featherstone/btMultiBody.cpp +++ b/src/BulletDynamics/Featherstone/btMultiBody.cpp @@ -749,7 +749,7 @@ void btMultiBody::computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar // Temporary matrices/vectors -- use scratch space from caller // so that we don't have to keep reallocating every frame - scratch_r.resize(2*m_dofCount + 6); //multidof? ("Y"s use it and it is used to store qdd) => 2 x m_dofCount + scratch_r.resize(2*m_dofCount + 7); //multidof? ("Y"s use it and it is used to store qdd) => 2 x m_dofCount scratch_v.resize(8*num_links + 6); scratch_m.resize(4*num_links + 4);