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.
llvm-svn: 174755
diff --git a/lldb/source/DataFormatters/CXXFormatterFunctions.cpp b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
index 78b63e9..1edb458 100644
--- a/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
+++ b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
@@ -157,7 +157,7 @@
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 @@
data_ptr++;
}
- *data_ptr = 0;
data_ptr = (SourceDataType*)data.GetDataStart();
lldb::DataBufferSP utf8_data_buffer_sp;