Description
During sentry__crashpad_handler crash_event is not synchronized properly.
When does the problem happen
Environment
- OS: Unrelated
- Compiler: Unrelated
- CMake version and config: Unrelated
Steps To Reproduce
For example sentry_set_tag that executed from one thread and sentry__crashpad_handler that capturing crash in another thread, may lead to a race condition while accessing crash_event variable.
sentry_set_tag call would lead to sentry__scope_flush_unlock call, that would lead to options->backend->flush_scope_func that would lead to crashpad_backend_flush_scope and access to a crash_event that may be freed by that line https://github.com/getsentry/sentry-native/blob/164da7919172b0df9c7b75efbc36e6e897124415/src/backends/sentry_backend_crashpad.cpp#L174C4-L174C4.
Description
During
sentry__crashpad_handlercrash_eventis not synchronized properly.When does the problem happen
Environment
Steps To Reproduce
For example
sentry_set_tagthat executed from one thread andsentry__crashpad_handlerthat capturing crash in another thread, may lead to a race condition while accessingcrash_eventvariable.sentry_set_tagcall would lead tosentry__scope_flush_unlockcall, that would lead tooptions->backend->flush_scope_functhat would lead tocrashpad_backend_flush_scopeand access to acrash_eventthat may be freed by that line https://github.com/getsentry/sentry-native/blob/164da7919172b0df9c7b75efbc36e6e897124415/src/backends/sentry_backend_crashpad.cpp#L174C4-L174C4.