From 0b588e7490eac4ef37b59c9265f1f3f05f4bb27c Mon Sep 17 00:00:00 2001 From: Brian Silverman Date: Tue, 31 Jul 2018 15:53:47 -0700 Subject: [PATCH 05/39] Fix uninitialized memory use in sampler_test Sampler's documentation states the following: C++03 requires that types stored in TLS be POD. As a result, you must initialize these members to {0, 0, false} before using this class! However, the test code wasn't doing that. MemorySanitizer and UndefinedBehaviorSanitizer both failed because of it. --- src/tests/sampler_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/sampler_test.cc b/src/tests/sampler_test.cc index e0d24d4..9a55b70 100755 --- a/src/tests/sampler_test.cc +++ b/src/tests/sampler_test.cc @@ -361,7 +361,7 @@ double StandardDeviationsErrorInSample( } TEST(Sampler, LargeAndSmallAllocs_CombinedTest) { - tcmalloc::Sampler sampler; + tcmalloc::Sampler sampler{0, 0, false}; sampler.Init(1); int counter_big = 0; int counter_small = 0; -- 1.8.3.1