From b204061d9fefa77200a2462986eb2214a8f8b1d0 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 11 Oct 2013 08:19:58 +0200 Subject: [PATCH] Fix crash in ClusterListener::ReplayLog(). --- components/cluster/clusterlistener.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/cluster/clusterlistener.cpp b/components/cluster/clusterlistener.cpp index fb6af6117..20fe633ec 100644 --- a/components/cluster/clusterlistener.cpp +++ b/components/cluster/clusterlistener.cpp @@ -443,9 +443,13 @@ void ClusterListener::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Ptr String message; while (true) { + Dictionary::Ptr pmessage; + try { if (!NetString::ReadStringFromStream(lstream, &message)) break; + + pmessage = Value::Deserialize(message); } catch (std::exception&) { Log(LogWarning, "cluster", "Unexpected end-of-file for cluster log: " + path); @@ -453,8 +457,6 @@ void ClusterListener::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Ptr break; } - Dictionary::Ptr pmessage = Value::Deserialize(message); - if (pmessage->Get("timestamp") < peer_ts) continue; -- 2.40.0