Chromium Code Reviews| Index: minidump/minidump_handle_writer.cc |
| diff --git a/minidump/minidump_handle_writer.cc b/minidump/minidump_handle_writer.cc |
| index 3d8a969ee7b71b7963fac9e09a5c54453d4a2a5f..6ec7e2e0dfa9344b26f0f870290bc3158401bcea 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(); |
| + size_t handle_count = handle_descriptors_.size(); |
| + if (!AssignIfInRange(&handle_data_stream_base_.NumberOfDescriptors, |
| + handle_count)) { |
|
Mark Mentovai
2015/10/21 22:19:26
You didn’t need handle_count, but if you want to k
scottmg
2015/10/21 22:35:53
Yeah, was for the LOG. Done.
|
| + LOG(ERROR) << "handle_count " << handle_count << " out of range"; |
| + return false; |
| + } |
| handle_data_stream_base_.Reserved = 0; |
| return true; |