Fix issues revealed by -ftrivial-auto-var-init=pattern

-ftrivial-auto-var-init=pattern automatically initializes all variables
with a pattern. This revealed two issues:

1. Unitialized read of field from CrashpadInfoClientOptions.
2. The PC distance check in TestCaptureContext (due to additional
instrumentation, the distance is now 76 on x86-64 and 92 on aarch64).

Change-Id: I528e5f21c70d2849c9300776da783fde59411e9e
Reviewed-on: https://chromium-review.googlesource.com/c/1471691
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Petr Hosek 2019-02-13 19:22:23 -08:00 committed by Commit Bot
parent bba9d0819c
commit 4dbd8c75d5
2 changed files with 3 additions and 2 deletions

View File

@ -39,7 +39,8 @@ TriState CrashpadInfoClientOptions::TriStateFromCrashpadInfo(
CrashpadInfoClientOptions::CrashpadInfoClientOptions()
: crashpad_handler_behavior(TriState::kUnset),
system_crash_reporter_forwarding(TriState::kUnset),
gather_indirectly_referenced_memory(TriState::kUnset) {
gather_indirectly_referenced_memory(TriState::kUnset),
indirectly_referenced_memory_cap(0) {
}
} // namespace crashpad

View File

@ -55,7 +55,7 @@ void TestCaptureContext() {
const uintptr_t kReferencePC =
reinterpret_cast<uintptr_t>(TestCaptureContext);
EXPECT_PRED2([](uintptr_t actual,
uintptr_t reference) { return actual - reference < 64u; },
uintptr_t reference) { return actual - reference < 128u; },
pc,
kReferencePC);
#endif // !defined(ADDRESS_SANITIZER)