[cfe-dev] [libclang] thread safety issue
Ranjeet Singh via cfe-dev
cfe-dev at lists.llvm.org
Thu Mar 30 07:23:12 PDT 2017
Hi,
I've found a potential race condition that can happen in the following code on variable ResourcesPath in tools/libclang/CIndexer.cpp
const std::string &CIndexer::getClangResourcesPath() {
// Did we already compute the path?
if (!ResourcesPath.empty())
return ResourcesPath;
SmallString<128> LibClangPath;
....
// Cache our result.
ResourcesPath = LibClangPath.str();
return ResourcesPath;
}
Variable ResourcesPath isn't synchronized on so it's possible that another thread might update ResourcesPath at the same time. Is it worth fixing this or is libclang advertised as not thread-safe so it's not worth fixing these types of bugs ?
Thanks,
Ranjeet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170330/d4e49b4f/attachment.html>
More information about the cfe-dev
mailing list