| Index: third_party/crashpad/crashpad/client/crash_report_database_win.cc
|
| diff --git a/third_party/crashpad/crashpad/client/crash_report_database_win.cc b/third_party/crashpad/crashpad/client/crash_report_database_win.cc
|
| index 7f4ede4f10bce43be51633b9ae6843b5b96892f5..d7968bd1ca8897771b32525faf9cb7c66660b26b 100644
|
| --- a/third_party/crashpad/crashpad/client/crash_report_database_win.cc
|
| +++ b/third_party/crashpad/crashpad/client/crash_report_database_win.cc
|
| @@ -18,6 +18,8 @@
|
| #include <time.h>
|
| #include <windows.h>
|
|
|
| +#include <utility>
|
| +
|
| #include "base/logging.h"
|
| #include "base/numerics/safe_math.h"
|
| #include "base/strings/string16.h"
|
| @@ -25,7 +27,6 @@
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "client/settings.h"
|
| #include "util/misc/initialization_state_dcheck.h"
|
| -#include "util/stdlib/move.h"
|
|
|
| namespace crashpad {
|
|
|
| @@ -417,26 +418,29 @@ void Metadata::Read() {
|
| return;
|
| }
|
|
|
| - std::vector<MetadataFileReportRecord> records(header.num_records);
|
| - if (!LoggingReadFile(handle_.get(), &records[0], records_size.ValueOrDie())) {
|
| - LOG(ERROR) << "failed to read records";
|
| - return;
|
| - }
|
| -
|
| - std::string string_table = ReadRestOfFileAsString(handle_.get());
|
| - if (string_table.empty() || string_table.back() != '\0') {
|
| - LOG(ERROR) << "bad string table";
|
| - return;
|
| - }
|
| -
|
| std::vector<ReportDisk> reports;
|
| - for (const auto& record : records) {
|
| - if (record.file_path_index >= string_table.size() ||
|
| - record.id_index >= string_table.size()) {
|
| - LOG(ERROR) << "invalid string table index";
|
| + if (header.num_records > 0) {
|
| + std::vector<MetadataFileReportRecord> records(header.num_records);
|
| + if (!LoggingReadFile(
|
| + handle_.get(), &records[0], records_size.ValueOrDie())) {
|
| + LOG(ERROR) << "failed to read records";
|
| return;
|
| }
|
| - reports.push_back(ReportDisk(record, report_dir_, string_table));
|
| +
|
| + std::string string_table = ReadRestOfFileAsString(handle_.get());
|
| + if (string_table.empty() || string_table.back() != '\0') {
|
| + LOG(ERROR) << "bad string table";
|
| + return;
|
| + }
|
| +
|
| + for (const auto& record : records) {
|
| + if (record.file_path_index >= string_table.size() ||
|
| + record.id_index >= string_table.size()) {
|
| + LOG(ERROR) << "invalid string table index";
|
| + return;
|
| + }
|
| + reports.push_back(ReportDisk(record, report_dir_, string_table));
|
| + }
|
| }
|
| reports_.swap(reports);
|
| }
|
| @@ -466,6 +470,9 @@ void Metadata::Write() {
|
| return;
|
| }
|
|
|
| + if (num_records == 0)
|
| + return;
|
| +
|
| // Build the records and string table we're going to write.
|
| std::string string_table;
|
| std::vector<MetadataFileReportRecord> records;
|
| @@ -816,7 +823,7 @@ scoped_ptr<CrashReportDatabase> InitializeInternal(
|
| scoped_ptr<CrashReportDatabaseWin> database_win(
|
| new CrashReportDatabaseWin(path));
|
| return database_win->Initialize(may_create)
|
| - ? crashpad::move(database_win)
|
| + ? std::move(database_win)
|
| : scoped_ptr<CrashReportDatabaseWin>();
|
| }
|
|
|
|
|