OLD | NEW |
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 Loading... |
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 §ions_[0])) { | 103 §ions_[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 Loading... |
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 |
OLD | NEW |