diff options
| author | Duncan Horn | 2025-09-25 04:31:49 -0700 |
|---|---|---|
| committer | GitHub | 2025-09-25 13:31:49 +0200 |
| commit | f7e7fa0983e83b922cb6336ff3a55d33b2873943 (patch) | |
| tree | 0dc0715cf30890ad4b88c2b3cf369516ce59cb0e /tests/SelfTest/UsageTests/ToStringVector.tests.cpp | |
| parent | b626e4c7aedb953e79784265e12283a62d5e94d3 (diff) | |
| download | catch3-f7e7fa0983e83b922cb6336ff3a55d33b2873943.tar.gz | |
Fix ReusableStringStream to access the container under the lock (#3031)
Commit 582200a made `ReusableStringStream`'s index reservation thread safe, however it's still accessing the `m_streams` vector outside the lock. This makes it so that the `add` call returns the pointer in addition to the index so that the lock doesn't need to get acquired again until destruction.
The issue with accessing `m_streams` outside the lock is that `add` can call `push_back` on the vector, which might re-allocate. If this re-allocation occurs concurrently with anther thread trying to index into this array, you get UB (typically a null pointer read).
Diffstat (limited to 'tests/SelfTest/UsageTests/ToStringVector.tests.cpp')
0 files changed, 0 insertions, 0 deletions