dyninst
dyninst copied to clipboard
Fix upgradePlaceholder in symtab/src/Type-mem.h
upgradePlaceholder
needs to go away. It's scribbling bits into the pointer owned by a boost::shared_ptr
. This is UB and possible thread unsafe. The fix is simple:
diff --git a/symtabAPI/src/Type-mem.h b/symtabAPI/src/Type-mem.h
index 356664982..146ddecff 100644
--- a/symtabAPI/src/Type-mem.h
+++ b/symtabAPI/src/Type-mem.h
@@ -85,7 +85,7 @@ boost::shared_ptr<Type>>::type typeCollection::addOrUpdateType(boost::shared_ptr
if (a->second->getDataClass() == dataUnknownType)
{
- upgradePlaceholder(a->second.get(), type.get());
+ a->second = type;
}
else
{
However, we need to make sure that resetting the passed shared_ptr is safe. Specifically, we need to make sure that there are no calls to shared_ptr::get
in between calls to addOrUpdateType
.