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

Side by Side Diff: snapshot/mac/mach_o_image_segment_reader.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 | « no previous file | snapshot/minidump/process_snapshot_minidump.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 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 segment_command_.vmaddr, 88 segment_command_.vmaddr,
89 segment_command_.vmsize); 89 segment_command_.vmsize);
90 if (!segment_range.IsValid()) { 90 if (!segment_range.IsValid()) {
91 LOG(WARNING) << base::StringPrintf("invalid segment range 0x%llx + 0x%llx", 91 LOG(WARNING) << base::StringPrintf("invalid segment range 0x%llx + 0x%llx",
92 segment_command_.vmaddr, 92 segment_command_.vmaddr,
93 segment_command_.vmsize) << segment_info; 93 segment_command_.vmsize) << segment_info;
94 return false; 94 return false;
95 } 95 }
96 96
97 sections_.resize(segment_command_.nsects); 97 sections_.resize(segment_command_.nsects);
98 if (!process_types::section::ReadArrayInto( 98 if (!sections_.empty() &&
99 !process_types::section::ReadArrayInto(
99 process_reader, 100 process_reader,
100 load_command_address + segment_command_.Size(), 101 load_command_address + segment_command_.Size(),
101 segment_command_.nsects, 102 segment_command_.nsects,
102 &sections_[0])) { 103 &sections_[0])) {
103 LOG(WARNING) << "could not read sections" << segment_info; 104 LOG(WARNING) << "could not read sections" << segment_info;
104 return false; 105 return false;
105 } 106 }
106 107
107 for (size_t section_index = 0; 108 for (size_t section_index = 0;
108 section_index < sections_.size(); 109 section_index < sections_.size();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 299 }
299 300
300 void MachOImageSegmentReader::SetSlide(mach_vm_size_t slide) { 301 void MachOImageSegmentReader::SetSlide(mach_vm_size_t slide) {
301 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 302 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
302 INITIALIZATION_STATE_SET_INITIALIZING(initialized_slide_); 303 INITIALIZATION_STATE_SET_INITIALIZING(initialized_slide_);
303 slide_ = slide; 304 slide_ = slide;
304 INITIALIZATION_STATE_SET_VALID(initialized_slide_); 305 INITIALIZATION_STATE_SET_VALID(initialized_slide_);
305 } 306 }
306 307
307 } // namespace crashpad 308 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | snapshot/minidump/process_snapshot_minidump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698