Merge pull request #7266 from Icinga/bugfix/array-bound-7265

Fix out-of-bounds crash with Array#remove
This commit is contained in:
Michael Friedrich 2019-06-28 17:13:55 +02:00 committed by GitHub
commit 8824e8c4cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View 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);
}