Author: jingham
Date: Thu Mar 20 12:13:28 2014
New Revision: 204359

URL: http://llvm.org/viewvc/llvm-project?rev=204359&view=rev
Log:
Guard against reading from host address of 0 in getting the data from a Value.

Modified:
    lldb/trunk/source/Core/Value.cpp

Modified: lldb/trunk/source/Core/Value.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=204359&r1=204358&r2=204359&view=diff
==============================================================================
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Thu Mar 20 12:13:28 2014
@@ -579,7 +579,12 @@ Value::GetValueAsData (ExecutionContext
     {
         if (address_type == eAddressTypeHost)
         {
-            // The address is an address in this process, so just copy it
+            // The address is an address in this process, so just copy it.
+            if (address == 0)
+            {
+                error.SetErrorStringWithFormat("trying to read from host 
address of 0.");
+                return error;
+            }
             memcpy (dst, (uint8_t*)NULL + address, byte_size);
         }
         else if ((address_type == eAddressTypeLoad) || (address_type == 
eAddressTypeFile))


_______________________________________________
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to