From cca548be8467ce9d6e854467b366ad3a00c487ee Mon Sep 17 00:00:00 2001 From: Alan Zhao Date: Mon, 19 Sep 2022 13:48:20 -0700 Subject: [PATCH] Minor fixes for crashpad_wer_main.cc These were suggested after https://crrev.com/c/3864248 was submitted. Change-Id: I73c451a3ea52721d8476e229cff7a0aded6746ac Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3902210 Commit-Queue: Alan Zhao Reviewed-by: Mark Mentovai Commit-Queue: Mark Mentovai --- handler/win/wer/crashpad_wer.cc | 4 ++-- handler/win/wer/crashpad_wer.h | 2 +- handler/win/wer/crashpad_wer_main.cc | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/handler/win/wer/crashpad_wer.cc b/handler/win/wer/crashpad_wer.cc index b4ca1a55..3379d00d 100644 --- a/handler/win/wer/crashpad_wer.cc +++ b/handler/win/wer/crashpad_wer.cc @@ -73,7 +73,7 @@ ScopedHandle DuplicateFromTarget(HANDLE target_process, HANDLE target_handle) { return ScopedHandle(hTmp); } -bool ProcessException(DWORD* handled_exceptions, +bool ProcessException(const DWORD* handled_exceptions, size_t num_handled_exceptions, const PVOID pContext, const PWER_RUNTIME_EXCEPTION_INFORMATION e_info) { @@ -193,7 +193,7 @@ bool ProcessException(DWORD* handled_exceptions, } // namespace bool ExceptionEvent( - DWORD* handled_exceptions, + const DWORD* handled_exceptions, size_t num_handled_exceptions, const PVOID pContext, const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation) { diff --git a/handler/win/wer/crashpad_wer.h b/handler/win/wer/crashpad_wer.h index 0dfc7c73..ee99e40c 100644 --- a/handler/win/wer/crashpad_wer.h +++ b/handler/win/wer/crashpad_wer.h @@ -37,7 +37,7 @@ namespace crashpad::wer { //! \return `true` if the target process was dumped by the crashpad handler then //! terminated, or `false` otherwise. bool ExceptionEvent( - DWORD* handled_exceptions, + const DWORD* handled_exceptions, size_t num_handled_exceptions, const PVOID pContext, const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation); diff --git a/handler/win/wer/crashpad_wer_main.cc b/handler/win/wer/crashpad_wer_main.cc index 69375203..1b767e38 100644 --- a/handler/win/wer/crashpad_wer_main.cc +++ b/handler/win/wer/crashpad_wer_main.cc @@ -36,17 +36,17 @@ HRESULT OutOfProcessExceptionEventCallback( PWSTR pwszEventName, PDWORD pchSize, PDWORD pdwSignatureCount) { - DWORD wanted_exceptions[] = { + static constexpr DWORD wanted_exceptions[] = { 0xC0000602, // STATUS_FAIL_FAST_EXCEPTION 0xC0000409, // STATUS_STACK_BUFFER_OVERRUN }; // Default to not-claiming as bailing out is easier. *pbOwnershipClaimed = FALSE; - bool result = - crashpad::wer::ExceptionEvent(wanted_exceptions, - sizeof(wanted_exceptions) / sizeof(DWORD), - pContext, - pExceptionInformation); + bool result = crashpad::wer::ExceptionEvent( + wanted_exceptions, + sizeof(wanted_exceptions) / sizeof(wanted_exceptions[0]), + pContext, + pExceptionInformation); if (result) { *pbOwnershipClaimed = TRUE;