Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: minidump/minidump_handle_writer.cc

Issue 1408073005: win: Fix x64 compile error in handle writer (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: minidump/minidump_handle_writer.cc
diff --git a/minidump/minidump_handle_writer.cc b/minidump/minidump_handle_writer.cc
index 3d8a969ee7b71b7963fac9e09a5c54453d4a2a5f..73eeb0c7c9ea6c83671e73315501fb06c7269a9b 100644
--- a/minidump/minidump_handle_writer.cc
+++ b/minidump/minidump_handle_writer.cc
@@ -20,6 +20,7 @@
#include "base/stl_util.h"
#include "minidump/minidump_extensions.h"
#include "util/file/file_writer.h"
+#include "util/numeric/safe_assignment.h"
namespace crashpad {
@@ -76,7 +77,12 @@ bool MinidumpHandleDataWriter::Freeze() {
handle_data_stream_base_.SizeOfHeader = sizeof(handle_data_stream_base_);
handle_data_stream_base_.SizeOfDescriptor = sizeof(handle_descriptors_[0]);
- handle_data_stream_base_.NumberOfDescriptors = handle_descriptors_.size();
+ const size_t handle_count = handle_descriptors_.size();
+ if (!AssignIfInRange(&handle_data_stream_base_.NumberOfDescriptors,
+ handle_count)) {
+ LOG(ERROR) << "handle_count " << handle_count << " out of range";
+ return false;
+ }
handle_data_stream_base_.Reserved = 0;
return true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698