diff --git a/handler/win/wer/crashpad_wer.cc b/handler/win/wer/crashpad_wer.cc index f3de028e..6266fab6 100644 --- a/handler/win/wer/crashpad_wer.cc +++ b/handler/win/wer/crashpad_wer.cc @@ -61,7 +61,8 @@ ScopedHandle DuplicateFromTarget(HANDLE target_process, HANDLE target_handle) { return ScopedHandle(hTmp); } -bool ProcessException(std::vector& handled_exceptions, +bool ProcessException(DWORD* handled_exceptions, + size_t num_handled_exceptions, const PVOID pContext, const PWER_RUNTIME_EXCEPTION_INFORMATION e_info) { // Need to have been given a context. @@ -72,13 +73,15 @@ bool ProcessException(std::vector& handled_exceptions, return false; // Only deal with exceptions that crashpad would not have handled. - if (handled_exceptions.size() && - std::find(handled_exceptions.begin(), - handled_exceptions.end(), - e_info->exceptionRecord.ExceptionCode) == - handled_exceptions.end()) { - return false; + bool found = false; + for (size_t i = 0; i < num_handled_exceptions; i++) { + if (handled_exceptions[i] == e_info->exceptionRecord.ExceptionCode) { + found = true; + break; + } } + if (!found) + return false; // Grab out the handles to the crashpad server. WerRegistration target_registration = {}; @@ -168,10 +171,14 @@ bool ProcessException(std::vector& handled_exceptions, } // namespace bool ExceptionEvent( - std::vector& handled_exceptions, + DWORD* handled_exceptions, + size_t num_handled_exceptions, const PVOID pContext, const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation) { - return ProcessException(handled_exceptions, pContext, pExceptionInformation); + return ProcessException(handled_exceptions, + num_handled_exceptions, + pContext, + pExceptionInformation); } } // namespace crashpad::wer diff --git a/handler/win/wer/crashpad_wer.h b/handler/win/wer/crashpad_wer.h index 5a3a52f9..1e820207 100644 --- a/handler/win/wer/crashpad_wer.h +++ b/handler/win/wer/crashpad_wer.h @@ -15,8 +15,6 @@ #ifndef CRASHPAD_HANDLER_WIN_WER_CRASHPAD_WER_H_ #define CRASHPAD_HANDLER_WIN_WER_CRASHPAD_WER_H_ -#include - #include #include @@ -26,9 +24,11 @@ namespace crashpad::wer { //! In the embedder's WER runtime exception helper, call this during //! OutOfProcessExceptionEventCallback(). //! -//! \param[in] handled_exceptions is a list of exception codes that the helper -//! should pass on to crashpad handler (if possible). Provide an empty list -//! to pass every exception on to the crashpad handler. +//! \param[in] handled_exceptions is an array of exception codes that the helper +//! should pass on to crashpad handler (if possible). Provide an empty +//! array to pass every exception on to the crashpad handler. +//! \param[in] num_handled_exceptions is the number of elements in the array +//! passed to handled_exceptions. //! \param[in] pContext is the context provided by WerFault to the helper. //! \param[in] pExceptionInformation is the exception information provided by //! WerFault to the helper DLL. @@ -36,7 +36,8 @@ namespace crashpad::wer { //! \return `true` if the target process was dumped by the crashpad handler then //! terminated, or `false` otherwise. bool ExceptionEvent( - std::vector& handled_exceptions, + 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 4613b353..d33e31eb 100644 --- a/handler/win/wer/crashpad_wer_main.cc +++ b/handler/win/wer/crashpad_wer_main.cc @@ -36,14 +36,17 @@ HRESULT OutOfProcessExceptionEventCallback( PWSTR pwszEventName, PDWORD pchSize, PDWORD pdwSignatureCount) { - std::vector wanted_exceptions = { + 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, pContext, pExceptionInformation); + bool result = + crashpad::wer::ExceptionEvent(wanted_exceptions, + sizeof(wanted_exceptions) / sizeof(DWORD), + pContext, + pExceptionInformation); if (result) { *pbOwnershipClaimed = TRUE;