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

Unified Diff: client/crashpad_client_win.cc

Issue 1464473003: win: Don't duplicate handles in handle restriction list (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: merge && Created 5 years, 1 month 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 | « client/client_test.gyp ('k') | client/crashpad_client_win_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/crashpad_client_win.cc
diff --git a/client/crashpad_client_win.cc b/client/crashpad_client_win.cc
index 8faebbf2fbe507f316044fd7d227a38a3b680f88..2ef07a7e5daddb24c3d03d0dfc322833b110839a 100644
--- a/client/crashpad_client_win.cc
+++ b/client/crashpad_client_win.cc
@@ -132,7 +132,8 @@ using ScopedProcThreadAttributeList =
base::ScopedGeneric<PPROC_THREAD_ATTRIBUTE_LIST,
ScopedProcThreadAttributeListTraits>;
-// Adds |handle| to |handle_list| if it appears valid.
+// Adds |handle| to |handle_list| if it appears valid, and is not already in
+// |handle_list|.
//
// Invalid handles (including INVALID_HANDLE_VALUE and null handles) cannot be
// added to a PPROC_THREAD_ATTRIBUTE_LIST’s PROC_THREAD_ATTRIBUTE_HANDLE_LIST.
@@ -142,7 +143,12 @@ using ScopedProcThreadAttributeList =
//
// Use this function to add handles with uncertain validities.
void AddHandleToListIfValid(std::vector<HANDLE>* handle_list, HANDLE handle) {
- if (handle && handle != INVALID_HANDLE_VALUE) {
+ // There doesn't seem to be any documentation of this, but if there's a handle
+ // duplicated in this list, CreateProcess() fails with
+ // ERROR_INVALID_PARAMETER.
+ if (handle && handle != INVALID_HANDLE_VALUE &&
+ std::find(handle_list->begin(), handle_list->end(), handle) ==
+ handle_list->end()) {
handle_list->push_back(handle);
}
}
@@ -337,6 +343,7 @@ bool CrashpadClient::UseHandler() {
DCHECK_EQ(g_signal_non_crash_dump, INVALID_HANDLE_VALUE);
DCHECK_EQ(g_non_crash_dump_done, INVALID_HANDLE_VALUE);
DCHECK(!g_critical_section_with_debug_info.DebugInfo);
+ DCHECK(!g_non_crash_dump_lock);
ClientToServerMessage message;
memset(&message, 0, sizeof(message));
« no previous file with comments | « client/client_test.gyp ('k') | client/crashpad_client_win_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698