Repository navigation
Fix out-of-bounds read in repeated bthread span tests - #3760
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the test now isolates per-run span state while restoring span configuration during cleanup.
No open issues 🎉
What changed in this PR
This PR fixes repeated execution of BthreadTest.test_span by replacing process-wide span state with per-test span objects and restoring span configuration on exit.
Changes:
- Replaces the static span counter and fixed ID array with a local span tree.
- Validates parent and nested span inheritance across scheduling orders.
- Restores span callbacks and the calling thread’s parent span with a scope guard.
| File | Description |
|---|---|
| test/bthread_unittest.cpp | Refactors the span propagation test to use isolated per-run span state, validate nested inheritance, and restore span configuration during cleanup. |
Review effort: Lite
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.
What problem does this PR solve?
Issue Number: resolve
Problem Summary:
BthreadTest.test_spanuses a static counter to index a four-element array of span IDs. The first run consumes all four entries. When Google Test repeats the test in the same process, the first span created on the second run reads past the end of the array.What is changed and the side effects?
Changed:
Side effects:
Performance effects:
Breaking backward compatibility:
Check List: