MSAN: Don't clear mjData.sensordata in mj_resetData

This is strictly an out array and should not be read before it is written to. This change improves MSAN coverage of engine code.

PiperOrigin-RevId: 819767673
Change-Id: I57500c8147f4774d326cf87ea3bac5420e4dd54d
This commit is contained in:
Yuval Tassa
2025-10-15 08:29:50 -07:00
committed by Copybara-Service
parent 99d93124f0
commit 5715cebbb9
3 changed files with 12 additions and 7 deletions
+2 -2
View File
@@ -69,7 +69,6 @@ using SensorTest = MujocoTest;
// --------------------- test sensor disableflag ------------------------------
// hand-picked positions and orientations for simple expected values
TEST_F(SensorTest, DisableSensors) {
constexpr char xml[] = R"(
<mujoco>
@@ -83,7 +82,8 @@ TEST_F(SensorTest, DisableSensors) {
ASSERT_THAT(model, NotNull()) << error;
mjData* data = mj_makeData(model);
// before calling anything, check that sensors are initialised to 0
// call mj_forward, expect clock to report 0
mj_forward(model, data);
EXPECT_EQ(data->sensordata[0], 0.0);
// call mj_step, mj_step1, expect clock to be incremented by timestep