summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorArnstein Ressem <aressem@gmail.com>2017-10-02 18:15:56 +0200
committerGitHub <noreply@github.com>2017-10-02 18:15:56 +0200
commit31a1e77a22c08fe93fa29daafdf301c69914d694 (patch)
treeba67a9f5f8e0cca7739ec702a9bdb10273daab2d /config
parent72e28a72370c6ab4756bb03c69090cc540db26a0 (diff)
Revert "Revert "Havardpe/avoid reading past json value in slime json parser""
Diffstat (limited to 'config')
-rw-r--r--config/src/vespa/config/frt/frtconfigresponsev3.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/config/src/vespa/config/frt/frtconfigresponsev3.cpp b/config/src/vespa/config/frt/frtconfigresponsev3.cpp
index 3791d3c55b7..379ebbd1803 100644
--- a/config/src/vespa/config/frt/frtconfigresponsev3.cpp
+++ b/config/src/vespa/config/frt/frtconfigresponsev3.cpp
@@ -58,11 +58,13 @@ FRTConfigResponseV3::readConfigValue() const
Slime * rawData = new Slime();
SlimePtr payloadData(rawData);
DecompressedData data(decompress(((*_returnValues)[1]._data._buf), ((*_returnValues)[1]._data._len), info.compressionType, info.uncompressedSize));
- size_t consumedSize = JsonFormat::decode(data.memRef, *rawData);
- if (consumedSize != data.size) {
- std::string json(make_json(*payloadData, true));
- LOG(error, "Error decoding JSON. Consumed size: %lu, uncompressed size: %u, compression type: %s, assumed uncompressed size(%u), compressed size: %u, slime(%s)", consumedSize, data.size, compressionTypeToString(info.compressionType).c_str(), info.uncompressedSize, ((*_returnValues)[1]._data._len), json.c_str());
- assert(false);
+ if (data.memRef.size > 0) {
+ size_t consumedSize = JsonFormat::decode(data.memRef, *rawData);
+ if (consumedSize == 0) {
+ std::string json(make_json(*payloadData, true));
+ LOG(error, "Error decoding JSON. Consumed size: %lu, uncompressed size: %u, compression type: %s, assumed uncompressed size(%u), compressed size: %u, slime(%s)", consumedSize, data.size, compressionTypeToString(info.compressionType).c_str(), info.uncompressedSize, ((*_returnValues)[1]._data._len), json.c_str());
+ assert(false);
+ }
}
if (LOG_WOULD_LOG(spam)) {
LOG(spam, "read config value md5(%s), payload size: %lu", md5.c_str(), data.memRef.size);