[Lldb-commits] [lldb] r163742 - /lldb/trunk/include/lldb/Core/FormatNavigator.h

Enrico Granata egranata at apple.com
Wed Sep 12 14:40:49 PDT 2012


Author: enrico
Date: Wed Sep 12 16:40:49 2012
New Revision: 163742

URL: http://llvm.org/viewvc/llvm-project?rev=163742&view=rev
Log:
Fixing a potential crasher related to running regular expressions against a NULL pointer

Modified:
    lldb/trunk/include/lldb/Core/FormatNavigator.h

Modified: lldb/trunk/include/lldb/Core/FormatNavigator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatNavigator.h?rev=163742&r1=163741&r2=163742&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatNavigator.h (original)
+++ lldb/trunk/include/lldb/Core/FormatNavigator.h Wed Sep 12 16:40:49 2012
@@ -425,13 +425,16 @@
     bool
     Get_Impl (ConstString key, MapValueType& value, lldb::RegularExpressionSP *dummy)
     {
+       const char* key_cstr = key.AsCString();
+       if (!key_cstr)
+           return false;
        Mutex& x_mutex = m_format_map.mutex();
        lldb_private::Mutex::Locker locker(x_mutex);
        MapIterator pos, end = m_format_map.map().end();
        for (pos = m_format_map.map().begin(); pos != end; pos++)
        {
            lldb::RegularExpressionSP regex = pos->first;
-           if (regex->Execute(key.AsCString()))
+           if (regex->Execute(key_cstr))
            {
                value = pos->second;
                return true;





More information about the lldb-commits mailing list