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

Unified Diff: snapshot/mac/process_reader.cc

Issue 1272283004: Check the size of of the dyld_all_image_infos structure before using it (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: snapshot/mac/process_reader.cc
diff --git a/snapshot/mac/process_reader.cc b/snapshot/mac/process_reader.cc
index 766367584e5063a3c0bee5b28902f2f1292fcd62..c7f674bbc97af0346448a2992c6725d0333a9a5b 100644
--- a/snapshot/mac/process_reader.cc
+++ b/snapshot/mac/process_reader.cc
@@ -374,7 +374,21 @@ void ProcessReader::InitializeModules() {
return;
}
- DCHECK_GE(all_image_infos.version, 1u);
+ if (all_image_infos.version < 1) {
+ LOG(WARNING) << "unexpected dyld_all_image_infos version "
+ << all_image_infos.version;
+ return;
+ }
+
+ size_t expected_size =
+ process_types::dyld_all_image_infos::ExpectedSizeForVersion(
+ this, all_image_infos.version);
+ if (dyld_info.all_image_info_size < expected_size) {
+ LOG(WARNING) << "small dyld_all_image_infos size "
+ << dyld_info.all_image_info_size << " < " << expected_size
+ << " for version " << all_image_infos.version;
+ return;
+ }
// Note that all_image_infos.infoArrayCount may be 0 if a crash occurred while
// dyld was loading the executable. This can happen if a required dynamic
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698