Fix wrong guard values for 64 bit.
I added the code to force alignments of 8 for 32 bit and 16 for 64 bit,
but I missed a couple of tests that failed due to this change. Fix the
failing tests.
Bug: 26739265
(cherry picked from commit 0e2a0265798ed47cbbf6977f0f84cf81d93173a6)
Change-Id: I21c3e26a340df6e427f06625e525b88b19b0cae1
diff --git a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
index 1c800db..b8535e1 100644
--- a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
@@ -208,19 +208,19 @@
}
TEST_F(MallocDebugConfigTest, multiple_options) {
- ASSERT_TRUE(InitConfig(" backtrace=64 front_guard=24"));
+ ASSERT_TRUE(InitConfig(" backtrace=64 front_guard=48"));
ASSERT_EQ(BACKTRACE | TRACK_ALLOCS | FRONT_GUARD, config->options);
ASSERT_EQ(64U, config->backtrace_frames);
- ASSERT_EQ(24U, config->front_guard_bytes);
+ ASSERT_EQ(48U, config->front_guard_bytes);
ASSERT_STREQ("", getFakeLogBuf().c_str());
ASSERT_STREQ("", getFakeLogPrint().c_str());
}
TEST_F(MallocDebugConfigTest, front_guard) {
- ASSERT_TRUE(InitConfig("front_guard=24"));
+ ASSERT_TRUE(InitConfig("front_guard=48"));
ASSERT_EQ(FRONT_GUARD, config->options);
- ASSERT_EQ(24U, config->front_guard_bytes);
+ ASSERT_EQ(48U, config->front_guard_bytes);
ASSERT_TRUE(InitConfig("front_guard"));
ASSERT_EQ(FRONT_GUARD, config->options);
@@ -228,7 +228,11 @@
ASSERT_TRUE(InitConfig("front_guard=39"));
ASSERT_EQ(FRONT_GUARD, config->options);
+#if defined(__LP64__)
+ ASSERT_EQ(48U, config->front_guard_bytes);
+#else
ASSERT_EQ(40U, config->front_guard_bytes);
+#endif
ASSERT_TRUE(InitConfig("front_guard=41"));
ASSERT_EQ(FRONT_GUARD, config->options);