[Lldb-commits] [lldb] r176438 - <rdar://problem/12897838>

Enrico Granata egranata at apple.com
Mon Mar 4 09:20:57 PST 2013


Author: enrico
Date: Mon Mar  4 11:20:57 2013
New Revision: 176438

URL: http://llvm.org/viewvc/llvm-project?rev=176438&view=rev
Log:
<rdar://problem/12897838>

Making sure we do not try to copy memory at address 0 - that would make us crash


Modified:
    lldb/trunk/source/Symbol/ClangASTType.cpp
    lldb/trunk/source/Symbol/Type.cpp

Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=176438&r1=176437&r2=176438&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Mon Mar  4 11:20:57 2013
@@ -1734,6 +1734,8 @@ ClangASTType::ReadFromMemory
     {
         if (address_type == eAddressTypeHost)
         {
+            if (addr == 0)
+                return false;
             // The address is an address in this process, so just copy it
             memcpy (dst, (uint8_t*)NULL + addr, byte_size);
             return true;

Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=176438&r1=176437&r2=176438&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Mon Mar  4 11:20:57 2013
@@ -439,6 +439,8 @@ Type::ReadFromMemory (ExecutionContext *
         if (address_type == eAddressTypeHost)
         {
             // The address is an address in this process, so just copy it
+            if (addr == 0)
+                return false;
             memcpy (dst, (uint8_t*)NULL + addr, byte_size);
             return true;
         }





More information about the lldb-commits mailing list