From 5dcef25f6f76bbc2fe9c81fd0edcbf3261d23c13 Mon Sep 17 00:00:00 2001 From: Asias He Date: Tue, 6 Mar 2018 09:01:19 +0800 Subject: [PATCH] storage_service: Add missing return in pieces empty check If pieces.empty is empty, it is bogus to access pieces[0]: sstring move_name = pieces[0]; Fix by adding the missing return. Spotted by Vlad Zolotarov Fixes #3258 Message-Id: (cherry picked from commit 8900e830a38e3ad5ec3d804a2db17de0ca1d63fd) --- service/storage_service.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/service/storage_service.cc b/service/storage_service.cc index b7125e02ff..79ba45c723 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -991,6 +991,7 @@ void storage_service::on_change(inet_address endpoint, application_state state, boost::split(pieces, value.value, boost::is_any_of(sstring(versioned_value::DELIMITER_STR))); if (pieces.empty()) { slogger.warn("Fail to split status in on_change: endpoint={}, app_state={}, value={}", endpoint, state, value); + return; } sstring move_name = pieces[0]; if (move_name == sstring(versioned_value::STATUS_BOOTSTRAPPING)) {