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

Unified Diff: third_party/crashpad/crashpad/snapshot/win/process_snapshot_win.cc

Issue 2585883002: Update Crashpad to 0567536f86fb10f9663fb30d6ebf08a7c35b975d (Closed)
Patch Set: Created 4 years 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
Index: third_party/crashpad/crashpad/snapshot/win/process_snapshot_win.cc
diff --git a/third_party/crashpad/crashpad/snapshot/win/process_snapshot_win.cc b/third_party/crashpad/crashpad/snapshot/win/process_snapshot_win.cc
index 63543c764bc6ee1fa07407bce8332b6a7bacdc1b..11e83145e31faf53527a22d4f75c6abcba5065c0 100644
--- a/third_party/crashpad/crashpad/snapshot/win/process_snapshot_win.cc
+++ b/third_party/crashpad/crashpad/snapshot/win/process_snapshot_win.cc
@@ -281,21 +281,43 @@ void ProcessSnapshotWin::InitializeUnloadedModules() {
#error port
#endif
- RTL_UNLOAD_EVENT_TRACE<Traits>* unload_event_trace_address =
- RtlGetUnloadEventTrace<Traits>();
- WinVMAddress address_in_target_process =
- reinterpret_cast<WinVMAddress>(unload_event_trace_address);
+ ULONG* element_size;
+ ULONG* element_count;
+ void* event_trace_address;
+ RtlGetUnloadEventTraceEx(&element_size, &element_count, &event_trace_address);
- std::vector<RTL_UNLOAD_EVENT_TRACE<Traits>> events(
- RTL_UNLOAD_EVENT_TRACE_NUMBER);
+ if (*element_size < sizeof(RTL_UNLOAD_EVENT_TRACE<Traits>)) {
+ LOG(ERROR) << "unexpected unloaded module list element size";
+ return;
+ }
+
+ const WinVMAddress address_in_target_process =
+ reinterpret_cast<WinVMAddress>(event_trace_address);
+
+ Traits::Pointer pointer_to_array;
if (!process_reader_.ReadMemory(address_in_target_process,
- events.size() * sizeof(events[0]),
- &events[0])) {
+ sizeof(pointer_to_array),
+ &pointer_to_array)) {
+ LOG(ERROR) << "failed to read target address";
+ return;
+ }
+
+ // No unloaded modules.
+ if (pointer_to_array == 0)
+ return;
+
+ const size_t data_size = *element_size * *element_count;
+ std::vector<uint8_t> data(data_size);
+ if (!process_reader_.ReadMemory(pointer_to_array, data_size, &data[0])) {
+ LOG(ERROR) << "failed to read unloaded module data";
return;
}
- for (const RTL_UNLOAD_EVENT_TRACE<Traits>& uet : events) {
- if (uet.ImageName[0]) {
+ for (ULONG i = 0; i < *element_count; ++i) {
+ const uint8_t* base_address = &data[i * *element_size];
+ const auto& uet =
+ *reinterpret_cast<const RTL_UNLOAD_EVENT_TRACE<Traits>*>(base_address);
+ if (uet.ImageName[0] != 0) {
unloaded_modules_.push_back(UnloadedModuleSnapshot(
uet.BaseAddress,
uet.SizeOfImage,

Powered by Google App Engine
This is Rietveld 408576698