<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi,</p>
<p><br>
</p>
<p>I've found a potential race condition that can happen in the following code on variable <span>ResourcesPath in tools/libclang/CIndexer.cpp</span></p>
<p><span><br>
</span></p>
<p><span></p>
<div>const std::string &CIndexer::getClangResourcesPath() {</div>
<div>  // Did we already compute the path?</div>
<div>  if (!ResourcesPath.empty())</div>
<div>    return ResourcesPath;</div>
<div><br>
</div>
<div>  SmallString<128> LibClangPath;</div>
<div><br>
</div>
<div>....</div>
<div>  // Cache our result.</div>
<div>  ResourcesPath = LibClangPath.str();</div>
<div>  return ResourcesPath;</div>
<div>}</div>
<div><br>
</div>
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 ?</span>
<p></p>
<p><span><br>
</span></p>
<p><span>Thanks,</span></p>
<p><span>Ranjeet</span></p>
</div>
</body>
</html>