From 6199766d99ec34485f5c62299939f3586d279143 Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Tue, 17 Dec 2013 22:21:40 +0000 Subject: Fix warnings from the Windows build. These warnings are fatal in my GYP-generated debug build. The warnings can be seen on Linux/Mac with -Wshorten-64-to-32. R=mark@chromium.org Review URL: https://breakpad.appspot.com/944002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1264 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/processor/minidump.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/processor') diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc index ab3aba10..5e81e67e 100644 --- a/src/processor/minidump.cc +++ b/src/processor/minidump.cc @@ -603,7 +603,6 @@ bool MinidumpContext::Read(uint32_t expected_size) { } context_.ppc64 = context_ppc64.release(); - context_flags_ = context_flags; } else if (expected_size == sizeof(MDRawContextARM64)) { // |context_flags| of MDRawContextARM64 is 64 bits, but other MDRawContext // in the else case have 32 bits |context_flags|, so special case it here. @@ -678,8 +677,17 @@ bool MinidumpContext::Read(uint32_t expected_size) { Swap(&context_arm64->float_save.regs[fpr_index]); } } + context_flags_ = static_cast(context_arm64->context_flags); + + // Check for data loss when converting context flags from uint64_t into + // uint32_t + if (static_cast(context_flags_) != + context_arm64->context_flags) { + BPLOG(ERROR) << "Data loss detected when converting ARM64 context_flags"; + return false; + } + context_.arm64 = context_arm64.release(); - context_flags_ = context_flags; } else { uint32_t context_flags; if (!minidump_->ReadBytes(&context_flags, sizeof(context_flags))) { -- cgit v1.2.1