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

Side by Side Diff: snapshot/minidump/process_snapshot_minidump.cc

Issue 1283243004: ubsan: Don’t call v[0] on empty vectors (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « snapshot/mac/mach_o_image_segment_reader.cc ('k') | util/mac/xattr.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (header_.Version != MINIDUMP_VERSION) { 58 if (header_.Version != MINIDUMP_VERSION) {
59 LOG(ERROR) << "minidump version mismatch"; 59 LOG(ERROR) << "minidump version mismatch";
60 return false; 60 return false;
61 } 61 }
62 62
63 if (!file_reader->SeekSet(header_.StreamDirectoryRva)) { 63 if (!file_reader->SeekSet(header_.StreamDirectoryRva)) {
64 return false; 64 return false;
65 } 65 }
66 66
67 stream_directory_.resize(header_.NumberOfStreams); 67 stream_directory_.resize(header_.NumberOfStreams);
68 if (!file_reader_->ReadExactly( 68 if (!stream_directory_.empty() &&
69 !file_reader_->ReadExactly(
69 &stream_directory_[0], 70 &stream_directory_[0],
70 header_.NumberOfStreams * sizeof(stream_directory_[0]))) { 71 header_.NumberOfStreams * sizeof(stream_directory_[0]))) {
71 return false; 72 return false;
72 } 73 }
73 74
74 for (const MINIDUMP_DIRECTORY& directory : stream_directory_) { 75 for (const MINIDUMP_DIRECTORY& directory : stream_directory_) {
75 const MinidumpStreamType stream_type = 76 const MinidumpStreamType stream_type =
76 static_cast<MinidumpStreamType>(directory.StreamType); 77 static_cast<MinidumpStreamType>(directory.StreamType);
77 if (stream_map_.find(stream_type) != stream_map_.end()) { 78 if (stream_map_.find(stream_type) != stream_map_.end()) {
78 LOG(ERROR) << "duplicate streams for type " << directory.StreamType; 79 LOG(ERROR) << "duplicate streams for type " << directory.StreamType;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 << "duplicate module_crashpad_info_list minidump_module_list_index " 317 << "duplicate module_crashpad_info_list minidump_module_list_index "
317 << minidump_link.minidump_module_list_index; 318 << minidump_link.minidump_module_list_index;
318 return false; 319 return false;
319 } 320 }
320 } 321 }
321 322
322 return true; 323 return true;
323 } 324 }
324 325
325 } // namespace crashpad 326 } // namespace crashpad
OLDNEW
« no previous file with comments | « snapshot/mac/mach_o_image_segment_reader.cc ('k') | util/mac/xattr.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698