From 2f44581f14d39c082dfe955e5f6ef6beba9d2a43 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 29 Jan 2015 14:14:56 +0100 Subject: [PATCH] Validate timeperiod segments fixes #8309 --- lib/config/configitem.cpp | 1 + lib/icinga/legacytimeperiod.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 17fe9da03..fbb59eb15 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -381,6 +381,7 @@ bool ConfigItem::ActivateItems(void) } upq.Join(); + upq.ReportExceptions("ConfigItem"); #ifdef I2_DEBUG BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) { diff --git a/lib/icinga/legacytimeperiod.cpp b/lib/icinga/legacytimeperiod.cpp index 0ef798991..6e380ad8c 100644 --- a/lib/icinga/legacytimeperiod.cpp +++ b/lib/icinga/legacytimeperiod.cpp @@ -379,6 +379,9 @@ void LegacyTimePeriod::ProcessTimeRanges(const String& timeranges, tm *reference BOOST_FOREACH(const String& range, ranges) { Dictionary::Ptr segment = ProcessTimeRange(range, reference); + if (segment->Get("begin") >= segment->Get("end")) + BOOST_THROW_EXCEPTION(std::invalid_argument("Time period segment ends before it begins")); + result->Add(segment); } } -- 2.40.0