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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 } | 367 } |
368 } | 368 } |
369 #endif | 369 #endif |
370 | 370 |
371 process_types::dyld_all_image_infos all_image_infos; | 371 process_types::dyld_all_image_infos all_image_infos; |
372 if (!all_image_infos.Read(this, dyld_info.all_image_info_addr)) { | 372 if (!all_image_infos.Read(this, dyld_info.all_image_info_addr)) { |
373 LOG(WARNING) << "could not read dyld_all_image_infos"; | 373 LOG(WARNING) << "could not read dyld_all_image_infos"; |
374 return; | 374 return; |
375 } | 375 } |
376 | 376 |
377 DCHECK_GE(all_image_infos.version, 1u); | 377 if (all_image_infos.version < 1) { |
| 378 LOG(WARNING) << "unexpected dyld_all_image_infos version " |
| 379 << all_image_infos.version; |
| 380 return; |
| 381 } |
| 382 |
| 383 size_t expected_size = |
| 384 process_types::dyld_all_image_infos::ExpectedSizeForVersion( |
| 385 this, all_image_infos.version); |
| 386 if (dyld_info.all_image_info_size < expected_size) { |
| 387 LOG(WARNING) << "small dyld_all_image_infos size " |
| 388 << dyld_info.all_image_info_size << " < " << expected_size |
| 389 << " for version " << all_image_infos.version; |
| 390 return; |
| 391 } |
378 | 392 |
379 // Note that all_image_infos.infoArrayCount may be 0 if a crash occurred while | 393 // Note that all_image_infos.infoArrayCount may be 0 if a crash occurred while |
380 // dyld was loading the executable. This can happen if a required dynamic | 394 // dyld was loading the executable. This can happen if a required dynamic |
381 // library was not found. Similarly, all_image_infos.infoArray may be nullptr | 395 // library was not found. Similarly, all_image_infos.infoArray may be nullptr |
382 // if a crash occurred while dyld was updating it. | 396 // if a crash occurred while dyld was updating it. |
383 // | 397 // |
384 // TODO(mark): It may be possible to recover from these situations by looking | 398 // TODO(mark): It may be possible to recover from these situations by looking |
385 // through memory mappings for Mach-O images. | 399 // through memory mappings for Mach-O images. |
386 // | 400 // |
387 // Continue along when this situation is detected, because even without any | 401 // Continue along when this situation is detected, because even without any |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 // The red zone would go lower into another region in memory, but no | 705 // The red zone would go lower into another region in memory, but no |
692 // region was found. Memory can only be captured to an address as low as | 706 // region was found. Memory can only be captured to an address as low as |
693 // the base address of the region already found. | 707 // the base address of the region already found. |
694 *start_address = *region_base; | 708 *start_address = *region_base; |
695 } | 709 } |
696 } | 710 } |
697 #endif | 711 #endif |
698 } | 712 } |
699 | 713 |
700 } // namespace crashpad | 714 } // namespace crashpad |
OLD | NEW |