diff options
| author | perst20 <[email protected]> | 2026-07-12 18:31:10 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2026-07-12 18:55:57 +0300 |
| commit | 5b991b83e00ca047828c60502386ca835029bab3 (patch) | |
| tree | e4b76c4a1de3892b7ec81dbb2f8d8dcf72605be5 /contrib/python/PyYAML | |
| parent | 7cf2e5a6f3716da406a37d3ef42431ec350cc9b6 (diff) | |
Fix use-after-free in TError during program shutdown
---
Type: fix
Component: library/cpp/yt/error
Problem: TError::Enricher_ and TError::FromExceptionEnricher_ are static class members whose destructors are registered when error.cpp is loaded. However, if any code calls Singleton<>() during static initialization before error.cpp loads, the OnExit handler gets registered in standard atexit() first. Due to LIFO ordering, at program exit the enrichers are destroyed before OnExit() runs, but OnExit() then destroys Singletons whose destructors may create TError objects (e.g., to cancel futures), which invokes Enrich() on the already-destroyed std::function, causing use-after-free. This can lead to intermittent segfaults depending on the link order of translation units.
Solution: Store enrichers in a LeakySingleton<TEnricherStorage> so they are never destroyed, as TError can be created anywhere including during program shutdown.
---
Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1582
commit_hash:a9607f0094b4c60414d00ebca844db6a2ceafeb9
Diffstat (limited to 'contrib/python/PyYAML')
0 files changed, 0 insertions, 0 deletions
