[llvm] 70b86ab - [CAS] Fix msan error in ObjectStore::importObject() (#167051)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 7 15:53:13 PST 2025
Author: Steven Wu
Date: 2025-11-07T23:53:09Z
New Revision: 70b86ab2177f5a0a1046d23fa407cb36852e2900
URL: https://github.com/llvm/llvm-project/commit/70b86ab2177f5a0a1046d23fa407cb36852e2900
DIFF: https://github.com/llvm/llvm-project/commit/70b86ab2177f5a0a1046d23fa407cb36852e2900.diff
LOG: [CAS] Fix msan error in ObjectStore::importObject() (#167051)
Fix msan error that reference to ObjectRef is used after the storage is
deleted. Make sure all usages is finished before deleting the container.
Added:
Modified:
llvm/lib/CAS/ObjectStore.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CAS/ObjectStore.cpp b/llvm/lib/CAS/ObjectStore.cpp
index 3110577e03774..c3f7a0c4c67ac 100644
--- a/llvm/lib/CAS/ObjectStore.cpp
+++ b/llvm/lib/CAS/ObjectStore.cpp
@@ -213,10 +213,13 @@ Expected<ObjectRef> ObjectStore::importObject(ObjectStore &Upstream,
// Remove the current node and its IDs from the stack.
PrimaryRefStack.truncate(PrimaryRefStack.size() - Cur.RefsCount);
- CursorStack.pop_back();
+ // Push new node into created objects.
PrimaryRefStack.push_back(*NewNode);
CreatedObjects.try_emplace(Cur.Ref, *NewNode);
+
+ // Pop the cursor in the end after all uses.
+ CursorStack.pop_back();
continue;
}
More information about the llvm-commits
mailing list