From 16ecfb9d6caaad03cc362aa3ce787a69bad1f24c Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Mon, 7 Aug 2017 19:56:52 +0100 Subject: [PATCH] MCOL-858 Preserve NULs in StringStore deserialize The fix for MCOL-838 broke VARBINARY as it truncated on the first NUL on StringStore deserialize. This fix uses append() to force a copy instead whilst preserving length. This fixes test012 --- utils/rowgroup/rowgroup.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/rowgroup/rowgroup.cpp b/utils/rowgroup/rowgroup.cpp index 519c74cea..886035b98 100755 --- a/utils/rowgroup/rowgroup.cpp +++ b/utils/rowgroup/rowgroup.cpp @@ -136,7 +136,10 @@ void StringStore::deserialize(ByteStream &bs) for (i = 0; i < count; i++) { //cout << "deserializing " << size << " bytes\n"; bs >> buf; - shared_ptr newString(new std::string(buf.c_str())); + // We do this to avoid pre-C++11 zero copy hell but need to + // preserve all data including NULs so using c_str() is out. + shared_ptr newString(new std::string()); + newString->append(buf); mem.push_back(newString); } return;