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

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: . 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
Index: client/crashpad_client_win.cc
diff --git a/client/crashpad_client_win.cc b/client/crashpad_client_win.cc
index 8faebbf2fbe507f316044fd7d227a38a3b680f88..2848f464258ae8bb64df37c2460bc6def9fdd396 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.
@@ -143,7 +144,13 @@ 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) {
- handle_list->push_back(handle);
+ // 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 (std::find(handle_list->begin(), handle_list->end(), handle) ==
+ handle_list->end()) {
+ handle_list->push_back(handle);
+ }
}
}
@@ -156,6 +163,13 @@ CrashpadClient::CrashpadClient()
}
CrashpadClient::~CrashpadClient() {
+ g_signal_exception = INVALID_HANDLE_VALUE;
Mark Mentovai 2015/11/19 19:00:19 Not so sure about this. The intention was that you
scottmg 2015/11/19 19:15:49 OK. We do have one soft request for being able to
Mark Mentovai 2015/11/19 19:20:57 scottmg wrote:
scottmg 2015/11/19 19:25:33 Sounds good.
+ g_signal_non_crash_dump = INVALID_HANDLE_VALUE;
+ g_non_crash_dump_done = INVALID_HANDLE_VALUE;
+ g_critical_section_with_debug_info.DebugInfo = nullptr;
+
+ delete g_non_crash_dump_lock;
+ g_non_crash_dump_lock = nullptr;
}
bool CrashpadClient::StartHandler(
@@ -337,6 +351,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));

Powered by Google App Engine
This is Rietveld 408576698