Explicitly zero out cinert of the world body.

Values of `cinert` are only set by `mj_comPos` for body 1 and above, which leaves the values for body 0 uninitialized. This triggers a `use-of-uninitialized-value` error under msan when the entire `cinert` array is read.

PiperOrigin-RevId: 545453619
Change-Id: I7bfdb4e4e33677903fc90c6ad070490aa65bf464
This commit is contained in:
Saran Tunyasuvunakool
2023-07-04 08:25:10 -07:00
committed by Copybara-Service
parent 95167fab2d
commit 2b38148d24
+3
View File
@@ -207,6 +207,9 @@ void mj_comPos(const mjModel* m, mjData* d) {
}
}
// zero out CoM frame inertia for the world body
mju_zero(d->cinert, 10);
// map inertias to frame centered at subtree_com
for (int i=1; i < m->nbody; i++) {
mju_sub3(offset, d->xipos+3*i, d->subtree_com+3*m->body_rootid[i]);