From a5fa28ddf0396e0cd77defde67d64cb8cde30a34 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Thu, 12 Mar 2020 18:20:58 -0700 Subject: [PATCH] Fix some bugs in CheckMicrodumpContents The crash address from the microdump was never checked against anything. Instead, the test was checking the value of a constant. On 32-bit systems, an intptr_t cannot represent kCrashAddress (0xDEADDEAD), causing a failure when the crash address is parsed from the microdump. Instead, use uintptr_t, which matches the type of kCrashAddress. Change-Id: Ib5612743803609f7801dcfb98deaa8779e362025 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2100816 Reviewed-by: Mike Frysinger --- .../linux/microdump_writer/microdump_writer_unittest.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/src/client/linux/microdump_writer/microdump_writer_unittest.cc index c2fea022..ca26fbfb 100644 --- a/src/client/linux/microdump_writer/microdump_writer_unittest.cc +++ b/src/client/linux/microdump_writer/microdump_writer_unittest.cc @@ -209,14 +209,14 @@ void CheckMicrodumpContents(const string& microdump_content, string token; unsigned crash_reason; string crash_reason_str; - intptr_t crash_address; + uintptr_t crash_address; crash_reason_tokens.ignore(2); // Ignore the "R " preamble. crash_reason_tokens >> std::hex >> crash_reason >> crash_reason_str >> crash_address; ASSERT_FALSE(crash_reason_tokens.fail()); ASSERT_EQ(MD_EXCEPTION_CODE_LIN_DUMP_REQUESTED, crash_reason); ASSERT_EQ("DUMP_REQUESTED", crash_reason_str); - ASSERT_EQ(0xDEADDEADu, kCrashAddress); + ASSERT_EQ(kCrashAddress, crash_address); did_find_crash_reason = true; } else if (line.find("V ") == 0) { if (expected_info.product_info)