[Lldb-commits] [lldb] r244984 - Don't crash when we have a .a file that contains an object with a 16 character name. Any calls to std::string::erase must be bounds checked.
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 13 16:16:16 PDT 2015
Author: gclayton
Date: Thu Aug 13 18:16:15 2015
New Revision: 244984
URL: http://llvm.org/viewvc/llvm-project?rev=244984&view=rev
Log:
Don't crash when we have a .a file that contains an object with a 16 character name. Any calls to std::string::erase must be bounds checked.
<rdar://problem/22260988>
Modified:
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=244984&r1=244983&r2=244984&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Thu Aug 13 18:16:15 2015
@@ -105,7 +105,9 @@ ObjectContainerBSDArchive::Object::Extra
{
// Strip off any spaces (if the object file name contains spaces it
// will use the extended format above).
- str.erase (str.find(' '));
+ const size_t space_pos = str.find(' ');
+ if (space_pos != std::string::npos)
+ str.erase (space_pos);
ar_name.SetCString(str.c_str());
}
More information about the lldb-commits
mailing list