diff --git a/CHANGELOG.md b/CHANGELOG.md index 99301f7bf..a0239fca5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - Native: don't dump the crash daemon's log to `stderr` on shutdown unless debug logging is enabled, so terminal applications stay quiet when `debug` is off. ([#1910](https://github.com/getsentry/sentry-native/pull/1910)) - Native/Windows: capture heap corruption crashes reported as `STATUS_HEAP_CORRUPTION` (`0xC0000374`). ([#1909](https://github.com/getsentry/sentry-native/pull/1909)) - Native/Linux: add support for `sentry_options_set_handler_strategy(SENTRY_HANDLER_STRATEGY_CHAIN_AT_START)`. ([#1912](https://github.com/getsentry/sentry-native/pull/1912)) +- Windows: the default thread stack guarantee is now actually applied in static builds and is also set by the native backend, so crash handling can run after a stack overflow. ([#1918](https://github.com/getsentry/sentry-native/pull/1918)) ## 0.15.4 diff --git a/src/backends/sentry_backend_native.c b/src/backends/sentry_backend_native.c index 7bef920da..1a685843d 100644 --- a/src/backends/sentry_backend_native.c +++ b/src/backends/sentry_backend_native.c @@ -191,6 +191,11 @@ native_backend_startup( "development."); SENTRY_DEBUG("starting native backend"); +#if defined(SENTRY_PLATFORM_WINDOWS) && !defined(SENTRY_BUILD_SHARED) \ + && defined(SENTRY_THREAD_STACK_GUARANTEE_AUTO_INIT) + sentry__set_default_thread_stack_guarantee(); +#endif + #if defined(SENTRY_PLATFORM_WINDOWS) // Create process-wide mutex for IPC synchronization (Windows) // Use portable mutex to protect Windows mutex creation diff --git a/src/sentry_core.c b/src/sentry_core.c index ce47a38d4..f0d151788 100644 --- a/src/sentry_core.c +++ b/src/sentry_core.c @@ -209,6 +209,13 @@ sentry_init(sentry_options_t *options) uint64_t last_crash = 0; +#if defined(SENTRY_PLATFORM_WINDOWS) \ + && (!defined(SENTRY_BUILD_SHARED) || defined(SENTRY_PLATFORM_XBOX)) + // This function must be positioned so that any dependents on its cached + // functions are invoked after it. + sentry__init_cached_kernel32_functions(); +#endif + // and then we will start the backend, since it requires a valid run sentry_backend_t *backend = options->backend; if (backend && backend->startup_func) { @@ -253,13 +260,6 @@ sentry_init(sentry_options_t *options) backend->user_consent_changed_func(backend); } -#if defined(SENTRY_PLATFORM_WINDOWS) \ - && (!defined(SENTRY_BUILD_SHARED) || defined(SENTRY_PLATFORM_XBOX)) - // This function must be positioned so that any dependents on its cached - // functions are invoked after it. - sentry__init_cached_kernel32_functions(); -#endif - // after initializing the transport, we will submit all the unsent envelopes // and handle remaining sessions. SENTRY_DEBUG("processing and pruning old runs");