Skip to content

fix: clear g_options before freeing options#1750

Open
jpnurmi wants to merge 2 commits into
masterfrom
jpnurmi/fix/options-clear
Open

fix: clear g_options before freeing options#1750
jpnurmi wants to merge 2 commits into
masterfrom
jpnurmi/fix/options-clear

Conversation

@jpnurmi
Copy link
Copy Markdown
Collaborator

@jpnurmi jpnurmi commented May 25, 2026

Fix a shutdown-time use-after-free window in sentry_close().

On POSIX, crash handlers can bypass the options mutex. If a signal arrived while sentry_close() had freed the options but not yet cleared the global pointer, the handler could acquire a reference to freed memory. Clear the global options pointer before releasing the final options reference so racing handlers observe no options.

A regression test covers that options are no longer exposed during teardown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant