Make msan treat mjData buffer as uninitialized in mj_resetData.

Indiscriminate memset into d->buffer and m->buffer previously caused msan to not detect uninitialized reads.

Also fix tests with uninitialized read bugs that are detected by msan after this change.

PiperOrigin-RevId: 451508224
Change-Id: I1f4b080a8ef765c34ba7a0adc2c686419f6e5516
This commit is contained in:
Saran Tunyasuvunakool
2022-05-27 16:33:38 -07:00
committed by Copybara-Service
parent ef9fa9dfe4
commit 185b79f664
5 changed files with 108 additions and 38 deletions
+1
View File
@@ -909,6 +909,7 @@ Euler integrator, semi-implicit in velocity.
def test_mj_ray(self):
# mj_ray has tricky argument types
geomid = np.zeros(1, np.int32)
mujoco.mj_forward(self.model, self.data)
mujoco.mj_ray(self.model, self.data, [0, 0, 0], [0, 0, 1], None, 0, 0,
geomid)
mujoco.mj_ray(self.model, self.data, [0, 0, 0], [0, 0, 1],