OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |