From 5377950861f7ae4f0564e6d03ec15de9714c8bdf Mon Sep 17 00:00:00 2001 From: scott snyder Date: Thu, 4 Apr 2019 06:24:01 +0200 Subject: [PATCH] IOVDbSvc: Prevent potential dereference of end iterator. Prevent a potential dereference of the end iterator of a map in IOVDbParser. Fixes unit test crash in SCT_ConditionsAlgorithms. --- Database/IOVDbSvc/src/IOVDbParser.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Database/IOVDbSvc/src/IOVDbParser.cxx b/Database/IOVDbSvc/src/IOVDbParser.cxx index 49da282b150..19a52fc054d 100644 --- a/Database/IOVDbSvc/src/IOVDbParser.cxx +++ b/Database/IOVDbSvc/src/IOVDbParser.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // IOVDbParser.cxx @@ -286,8 +286,10 @@ IOVDbParser::iovOverrideValue() const{ unsigned long long value{}; if (not overridesIov()) return value; auto pTsPair = m_keys.find("forceTimestamp"); - value = IOVDbNamespace::iovFromTimeString(pTsPair->second); - if (pTsPair==m_keys.end()){ + if (pTsPair!=m_keys.end()){ + value = IOVDbNamespace::iovFromTimeString(pTsPair->second); + } + else { auto pRunPair = m_keys.find("forceRunNumber"); auto pLumiPair = m_keys.find("forceLumiblockNumber"); const auto & runString = (pRunPair!=m_keys.end()) ? pRunPair->second : ""; -- GitLab