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.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174755 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/DataFormatters/CXXFormatterFunctions.cpp b/source/DataFormatters/CXXFormatterFunctions.cpp
index 78b63e9..1edb458 100644
--- a/source/DataFormatters/CXXFormatterFunctions.cpp
+++ b/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;