[Lldb-commits] [lldb] r164653 - /lldb/trunk/source/Target/PathMappingList.cpp

Sean Callanan scallanan at apple.com
Tue Sep 25 18:28:11 PDT 2012


Author: spyffe
Date: Tue Sep 25 20:28:11 2012
New Revision: 164653

URL: http://llvm.org/viewvc/llvm-project?rev=164653&view=rev
Log:
Fixed a bug in the path remapper that caused
a crash if the path to be remaped was NULL.

<rdar://problem/12371888>

Modified:
    lldb/trunk/source/Target/PathMappingList.cpp

Modified: lldb/trunk/source/Target/PathMappingList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/PathMappingList.cpp?rev=164653&r1=164652&r2=164653&view=diff
==============================================================================
--- lldb/trunk/source/Target/PathMappingList.cpp (original)
+++ lldb/trunk/source/Target/PathMappingList.cpp Tue Sep 25 20:28:11 2012
@@ -172,12 +172,17 @@
 bool
 PathMappingList::RemapPath (const ConstString &path, ConstString &new_path) const
 {
+    const char *path_cstr = path.GetCString();
+    
+    if (!path_cstr)
+        return false;
+    
     const_iterator pos, end = m_pairs.end();
     for (pos = m_pairs.begin(); pos != end; ++pos)
     {
         const size_t prefixLen = pos->first.GetLength();
 
-        if (::strncmp (pos->first.GetCString(), path.GetCString(), prefixLen) == 0)
+        if (::strncmp (pos->first.GetCString(), path_cstr, prefixLen) == 0)
         {
             std::string new_path_str (pos->second.GetCString());
             new_path_str.append(path.GetCString() + prefixLen);





More information about the lldb-commits mailing list