diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index 40ce1f73a0e895f5f2084a6ad2d88f48b45b7ebc..7b9707159a4c4145893487b0086025ff9a2b96c7 100644
--- a/indra/llxml/llcontrol.cpp
+++ b/indra/llxml/llcontrol.cpp
@@ -50,6 +50,8 @@
 #include "lltimer.h"
 #include "lldir.h"
 
+#include <boost/iostreams/stream.hpp>
+
 #if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
 #define CONTROL_ERRS LL_ERRS("ControlErrors")
 #else
@@ -203,7 +205,8 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value)
 	{
 		LLPointer<LLSDNotationParser> parser = new LLSDNotationParser;
 		LLSD result;
-		std::stringstream value_stream(value.asString());
+		const auto& llsd_str = value.asStringRef();
+		boost::iostreams::stream<boost::iostreams::array_source> value_stream(llsd_str.data(), llsd_str.size());
 		if (parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED) != LLSDParser::PARSE_FAILURE)
 		{
 			storable_value = result;
diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp
index 162d6e003e94a7bbf5dfb9441b0ae54863802bda..4cc17f6d0d5a7d9e8468d5db49d7356c8afe1313 100644
--- a/indra/newview/lllocationhistory.cpp
+++ b/indra/newview/lllocationhistory.cpp
@@ -34,6 +34,9 @@
 #include "llsd.h"
 #include "llsdserialize.h"
 
+#include <boost/iostreams/device/array.hpp>
+#include <boost/iostreams/stream.hpp>
+
 LLLocationHistory::LLLocationHistory() :
 	mFilename("typed_locations.txt")
 {
@@ -163,7 +166,7 @@ void LLLocationHistory::load()
 	LLPointer<LLSDParser> parser = new LLSDNotationParser();
 	while (std::getline(file, line)) {
 		LLSD s_item;
-		std::istringstream iss(line);
+		boost::iostreams::stream<boost::iostreams::array_source> iss(line.data(), line.size());
 		if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
 		{
 			LL_INFOS()<< "Parsing saved teleport history failed" << LL_ENDL;