From 772dcf57ff1123c8bc8652872cc82a031a147a3d Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Sat, 2 Apr 2022 00:55:14 +0200 Subject: [PATCH] Fix uninitialized read in rpyFromMatrix The computation of `rpy(1)` tries to take the sin of `rpy(0)` (which is only initialized a line later). --- src/BulletInverseDynamics/IDMath.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BulletInverseDynamics/IDMath.cpp b/src/BulletInverseDynamics/IDMath.cpp index 2f120ed48..0c3f5c9d4 100644 --- a/src/BulletInverseDynamics/IDMath.cpp +++ b/src/BulletInverseDynamics/IDMath.cpp @@ -503,8 +503,8 @@ vec3 rpyFromMatrix(const mat33 &rot) { vec3 rpy; rpy(2) = BT_ID_ATAN2(-rot(1, 0), rot(0, 0)); - rpy(1) = BT_ID_ATAN2(rot(2, 0), BT_ID_COS(rpy(2)) * rot(0, 0) - BT_ID_SIN(rpy(0)) * rot(1, 0)); rpy(0) = BT_ID_ATAN2(-rot(2, 0), rot(2, 2)); + rpy(1) = BT_ID_ATAN2(rot(2, 0), BT_ID_COS(rpy(2)) * rot(0, 0) - BT_ID_SIN(rpy(0)) * rot(1, 0)); return rpy; } } // namespace btInverseDynamics