Skip to content

Fix heap use-after-free in thread/thread_manager.cc#846

Draft
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_943925826
Draft

Fix heap use-after-free in thread/thread_manager.cc#846
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_943925826

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Jul 7, 2026

Copy link
Copy Markdown

Fix heap use-after-free in thread/thread_manager.cc

Details are in the bug, but briefly: when thread_limit == INT_MAX, the counter queue_running is deliberately not maintained. When the pool is shut down, outstanding work items are enumerated and tracked retroactively. However, any work scheduled after this retroactive tracking is not itself tracked, resulting in premature freeing of data structures.

We thus modify the code to enable tracking once shutdown has started, even under thread_limit == INT_MAX.

Details are in the bug, but briefly: when thread_limit == INT_MAX, the counter queue_running is deliberately not maintained. When the pool is shut down, outstanding work items are enumerated and tracked retroactively. However, any work scheduled _after_ this retroactive tracking is not itself tracked, resulting in premature freeing of data structures.

We thus modify the code to enable tracking once shutdown has started, even under thread_limit == INT_MAX.

PiperOrigin-RevId: 943925826
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