llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) <details> <summary>Changes</summary> The `locked` variable can be accessed from the asynchronous thread until the call to f.wait() completes. However, the variable is scoped in a lexical block that ends before that, leading to a use-after-free. --- Full diff: https://github.com/llvm/llvm-project/pull/133840.diff 1 Files Affected: - (modified) lldb/unittests/API/SBMutexTest.cpp (+1-2) ``````````diff diff --git a/lldb/unittests/API/SBMutexTest.cpp b/lldb/unittests/API/SBMutexTest.cpp index 0b888c2725aa9..aafad59d58c17 100644 --- a/lldb/unittests/API/SBMutexTest.cpp +++ b/lldb/unittests/API/SBMutexTest.cpp @@ -32,10 +32,9 @@ class SBMutexTest : public testing::Test { TEST_F(SBMutexTest, LockTest) { lldb::SBTarget target = debugger.GetDummyTarget(); - + std::atomic<bool> locked = false; std::future<void> f; { - std::atomic<bool> locked = false; lldb::SBMutex lock = target.GetAPIMutex(); std::lock_guard<lldb::SBMutex> lock_guard(lock); ASSERT_FALSE(locked.exchange(true)); `````````` </details> https://github.com/llvm/llvm-project/pull/133840 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits