While it's true that SmallString, and hence SmallVector support non null-terminated strings, it worries me if we have a non null-terminated string somewhere in LLDB.  <br><br><div class="gmail_quote">On Mon Jan 19 2015 at 8:25:17 PM Jason Molenda <<a href="mailto:jmolenda@apple.com">jmolenda@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jmolenda<br>
Date: Mon Jan 19 22:20:42 2015<br>
New Revision: 226544<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=226544&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=226544&view=rev</a><br>
Log:<br>
Fix creation of StringRef in FileSpec::ResolveUsername()<br>
so it doesn't assume that the SmallVector<char> will have<br>
nul terminator.  It did not in at least one case.<br>
Caught by ASAN instrumentation.<br>
<br>
Modified:<br>
    lldb/trunk/source/Host/common/<u></u>FileSpec.cpp<br>
<br>
Modified: lldb/trunk/source/Host/common/<u></u>FileSpec.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=226544&r1=226543&r2=226544&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/lldb/trunk/source/<u></u>Host/common/FileSpec.cpp?rev=<u></u>226544&r1=226543&r2=226544&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- lldb/trunk/source/Host/common/<u></u>FileSpec.cpp (original)<br>
+++ lldb/trunk/source/Host/common/<u></u>FileSpec.cpp Mon Jan 19 22:20:42 2015<br>
@@ -65,7 +65,7 @@ FileSpec::ResolveUsername (llvm::SmallVe<br>
     if (path.empty() || path[0] != '~')<br>
         return;<br>
<br>
-    llvm::StringRef path_str(path.data());<br>
+    llvm::StringRef path_str(path.data(), path.size());<br>
     size_t slash_pos = path_str.find_first_of("/", 1);<br>
     if (slash_pos == 1 || path.size() == 1)<br>
     {<br>
<br>
<br>
______________________________<u></u>_________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/lldb-commits</a><br>
</blockquote></div>