Skip to content

Commit

Permalink
Fix ASan problems in pose_aggregator_test.cc and normalize_vector.h (R…
Browse files Browse the repository at this point in the history
…obotLocomotion#11395)

* Fix an Asan problem in pose_aggregator_test.cc

* Fix an ASan issue in normalize_vector.h
  • Loading branch information
m-chaturvedi authored May 7, 2019
1 parent 6ec656b commit 712145e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions math/normalize_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ void NormalizeVector(

if (ddx_norm) {
auto dx_norm_transpose = transposeGrad(*dx_norm, x.rows());
auto ddx_norm_times_norm = -matGradMultMat(
auto minus_ddx_norm_times_norm = matGradMultMat(
x_norm, x_norm.transpose(), (*dx_norm), dx_norm_transpose);
auto dnorm_inv = -x.transpose() / (xdotx * norm_x);
(*ddx_norm) = ddx_norm_times_norm / norm_x;
(*ddx_norm) = -minus_ddx_norm_times_norm / norm_x;
auto temp = (*dx_norm) * norm_x;
typename Derived::Index n = x.rows();
for (int col = 0; col < n; col++) {
Expand Down
5 changes: 3 additions & 2 deletions systems/rendering/test/pose_aggregator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,10 @@ TEST_F(PoseAggregatorTest, AddSinglePoseAndVelocityPorts) {
// Tests that PoseBundle supports Symbolic form.
GTEST_TEST(PoseBundleTest, Symbolic) {
PoseBundle<symbolic::Expression> dut{1};

multibody::SpatialVelocity<symbolic::Expression> msv =
dut.get_velocity(0).get_velocity();
// Just sanity check that some element got zero-initialized.
const symbolic::Expression& x = dut.get_velocity(0).get_velocity()[0];
const symbolic::Expression& x = msv[0];
EXPECT_TRUE(x.EqualTo(0.0));
}

Expand Down

0 comments on commit 712145e

Please sign in to comment.