]> granicus.if.org Git - icinga2/commitdiff
Fix Icinga when calling array.remove() 7266/head
authorDiana Flach <crunsher@bamberg.ccc.de>
Fri, 28 Jun 2019 14:12:58 +0000 (16:12 +0200)
committerDiana Flach <crunsher@bamberg.ccc.de>
Fri, 28 Jun 2019 14:37:29 +0000 (16:37 +0200)
fixes #7265

lib/base/array.cpp

index 5e3f3c69f9610790c8d86c09f1665ce0b2a01796..d9f360c77187af0f34390ed0c202b8f11cbc6239 100644 (file)
@@ -175,6 +175,9 @@ void Array::Remove(SizeType index, bool overrideFrozen)
        if (m_Frozen && !overrideFrozen)
                BOOST_THROW_EXCEPTION(std::invalid_argument("Array must not be modified."));
 
+       if (index >= m_Data.size())
+               BOOST_THROW_EXCEPTION(std::invalid_argument("Index to remove must be within bounds."));
+
        m_Data.erase(m_Data.begin() + index);
 }