[Lldb-commits] [lldb] r174755 - Fixed a store to data that isn't needed and that also could end up writing beyond the end of the buffer. This was found by the address sanitizer.

Greg Clayton gclayton at apple.com
Fri Feb 8 13:59:34 PST 2013


Author: gclayton
Date: Fri Feb  8 15:59:34 2013
New Revision: 174755

URL: http://llvm.org/viewvc/llvm-project?rev=174755&view=rev
Log:
Fixed a store to data that isn't needed and that also could end up writing beyond the end of the buffer. This was found by the address sanitizer.


Modified:
    lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp

Modified: lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp?rev=174755&r1=174754&r2=174755&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp (original)
+++ lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp Fri Feb  8 15:59:34 2013
@@ -157,7 +157,7 @@ DumpUTFBufferToStream (ConversionResult
         if (sourceSize == 0)
         {
             const int origin_encoding = 8*sizeof(SourceDataType);
-            sourceSize = bufferSPSize/(origin_encoding >> 2);
+            sourceSize = bufferSPSize/(origin_encoding / 4);
         }
         
         SourceDataType *data_ptr = (SourceDataType*)data.GetDataStart();
@@ -173,7 +173,6 @@ DumpUTFBufferToStream (ConversionResult
             data_ptr++;
         }
         
-        *data_ptr = 0;
         data_ptr = (SourceDataType*)data.GetDataStart();
         
         lldb::DataBufferSP utf8_data_buffer_sp;





More information about the lldb-commits mailing list