From e9057e2d5e9515f38fb06ff4ad968a6845f10fd3 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 11 Jul 2022 21:02:22 -0700 Subject: [PATCH] stackwalker_mips64_unittest: default-init MIPS context This test's constructor fails to fully initialize this raw context. As a result, we have at least one use of uninitialized memory in CFI.At4004. This causes said test to fail under ASAN. Bug: b:235999011 Change-Id: I3279da8ac3414eb8c90f3949a1db47a03e750a94 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3756749 Reviewed-by: Mike Frysinger --- src/processor/stackwalker_mips64_unittest.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/processor/stackwalker_mips64_unittest.cc b/src/processor/stackwalker_mips64_unittest.cc index c3c3011a..e1bf5086 100644 --- a/src/processor/stackwalker_mips64_unittest.cc +++ b/src/processor/stackwalker_mips64_unittest.cc @@ -645,8 +645,10 @@ struct CFIFixture: public StackwalkerMIPSFixture { EXPECT_EQ(0x00405000U, frame1->function_base); } - // The values we expect to find for the caller's registers. - MDRawContextMIPS expected; + // The values we expect to find for the caller's registers. Forcibly + // default-init it, since it's POD and not all bits are always overwritten by + // the constructor. + MDRawContextMIPS expected{}; // The validity mask for expected. int expected_validity;