From: Gunnar Beutner Date: Thu, 29 Jan 2015 13:14:56 +0000 (+0100) Subject: Validate timeperiod segments X-Git-Tag: v2.3.0~317 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f44581f14d39c082dfe955e5f6ef6beba9d2a43;p=icinga2 Validate timeperiod segments fixes #8309 --- 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); } }