Repository navigation
libobs: free registered types after obs_free_data() in obs_shutdown() (#2017) - #2022
Merged
Merged
Conversation
…ED, #2017) test_shutdown_type_lifetime leaves an input of a test type and a scene in the main canvas alive and shuts down. Fails on master: the type's free_type_data runs before obs_free_data() destroys the source (test_shutdown_type_lifetime.c:93, local Tier 2). Under ASan the same order is a heap-use-after-free in obs_canvas_destroy().
… (GREEN, #2017) Sources still alive at shutdown are destroyed in obs_free_data() and read their type's registration: obs_canvas_destroy() strcmp()s info.id through obs_source_is_scene(), and destroy callbacks use type_data. obs_shutdown() freed the source types' ids and every type's type_data first (ASan heap-use-after-free in test_context_names). The type tables are now freed after obs_free_data(); free_type_data therefore runs after the modules' obs_module_unload(), as the sources' destroys already did (libobs never dlcloses a module).
Member
Author
|
Local Tier 2 with the fix, both libobs builds: |
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2017.
test_shutdown_type_lifetime. It leaves an input of a test type and a scene in the main canvas alive, then shuts down. In local Tier 2 it fails attest_shutdown_type_lifetime.c:93(assert_false(destroyed_after_type_freed)): the type'sfree_type_dataran beforeobs_free_data()destroyed the source. Under ASan the same order is the heap-use-after-free inobs_canvas_destroy→obs_source_is_scene(Sanitizers run 40044944211).obs_shutdown()frees the source type ids and every registered type'stype_dataafterobs_free_data(), so no object outlives its type's registration. Local Tier 2 with the fix: 406/406 passed, including the new test. That was the first of the run's two libobs builds; PR CI runs both.Ordering note:
free_type_datanow runs after the modules'obs_module_unload(), where the sources' destroys already ran. libobs neverdlcloses a module (free_module), so plugin code is still mapped.Upstream OBS has the same order. Low risk: shutdown only, reached when a host has not released its sources, and only from trusted local input. Public API only; no existing C test or public header changed. No features.md entry (no user-visible change).