mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-28 15:50:26 +08:00
Fix 32-bit Windows downcast build failure
Bug: crashpad:264 Change-Id: Ie185fbe6fe909568b7364496586fb950c074674f Reviewed-on: https://chromium-review.googlesource.com/c/1318378 Commit-Queue: Scott Graham <scottmg@chromium.org> Reviewed-by: Scott Graham <scottmg@chromium.org>
This commit is contained in:
parent
a008d8a151
commit
1b20b620cf
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "base/numerics/safe_math.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
@ -98,7 +100,8 @@ const MemorySnapshot* MemorySnapshotMinidump::MergeWithOtherSnapshot(
|
|||||||
return result.release();
|
return result.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
result->data_.resize(other_cast->address_ - address_);
|
result->data_.resize(
|
||||||
|
base::checked_cast<size_t>(other_cast->address_ - address_));
|
||||||
result->data_.insert(result->data_.end(), other_cast->data_.begin(),
|
result->data_.insert(result->data_.end(), other_cast->data_.begin(),
|
||||||
other_cast->data_.end());
|
other_cast->data_.end());
|
||||||
return result.release();
|
return result.release();
|
||||||
|
@ -20,11 +20,12 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "base/numerics/safe_math.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_context.h"
|
#include "minidump/minidump_context.h"
|
||||||
#include "snapshot/minidump/minidump_annotation_reader.h"
|
|
||||||
#include "snapshot/memory_map_region_snapshot.h"
|
#include "snapshot/memory_map_region_snapshot.h"
|
||||||
|
#include "snapshot/minidump/minidump_annotation_reader.h"
|
||||||
#include "snapshot/module_snapshot.h"
|
#include "snapshot/module_snapshot.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/misc/pdb_structures.h"
|
#include "util/misc/pdb_structures.h"
|
||||||
@ -323,7 +324,8 @@ TEST(ProcessSnapshotMinidump, Modules) {
|
|||||||
for (uint32_t i = 0; i < minidump_module_count; i++) {
|
for (uint32_t i = 0; i < minidump_module_count; i++) {
|
||||||
name_rvas[i] = static_cast<RVA>(string_file.SeekGet());
|
name_rvas[i] = static_cast<RVA>(string_file.SeekGet());
|
||||||
auto name16 = base::UTF8ToUTF16(names[i]);
|
auto name16 = base::UTF8ToUTF16(names[i]);
|
||||||
uint32_t size = sizeof(name16[0]) * name16.size();
|
uint32_t size =
|
||||||
|
base::checked_cast<uint32_t>(sizeof(name16[0]) * name16.size());
|
||||||
EXPECT_TRUE(string_file.Write(&size, sizeof(size)));
|
EXPECT_TRUE(string_file.Write(&size, sizeof(size)));
|
||||||
EXPECT_TRUE(string_file.Write(&name16[0], size));
|
EXPECT_TRUE(string_file.Write(&name16[0], size));
|
||||||
}
|
}
|
||||||
@ -1066,7 +1068,8 @@ TEST(ProcessSnapshotMinidump, Stacks) {
|
|||||||
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
|
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
|
||||||
};
|
};
|
||||||
|
|
||||||
minidump_thread.Stack.Memory.DataSize = minidump_stack.size();
|
minidump_thread.Stack.Memory.DataSize =
|
||||||
|
base::checked_cast<uint32_t>(minidump_stack.size());
|
||||||
minidump_thread.Stack.Memory.Rva = static_cast<RVA>(string_file.SeekGet());
|
minidump_thread.Stack.Memory.Rva = static_cast<RVA>(string_file.SeekGet());
|
||||||
|
|
||||||
EXPECT_TRUE(string_file.Write(minidump_stack.data(), minidump_stack.size()));
|
EXPECT_TRUE(string_file.Write(minidump_stack.data(), minidump_stack.size()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user