From: David Wells Date: Thu, 6 Jan 2022 20:30:30 +0000 (-0500) Subject: Add some more index range checks. X-Git-Tag: v9.4.0-rc1~656^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13182%2Fhead;p=dealii.git Add some more index range checks. We presently segmentation fault with #13179 (the draft intel oneAPI patch) here since ptr and data are both empty. --- diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index 0b8d1e5394..d7240ef755 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -4688,11 +4688,15 @@ namespace internal if (fu == nullptr) return; + AssertIndexRange(range_index + 1, ptr.size()); for (unsigned int i = ptr[range_index]; i < ptr[range_index + 1]; ++i) - (container.*fu)(matrix_free, - this->dst, - this->src, - std::make_pair(data[2 * i], data[2 * i + 1])); + { + AssertIndexRange(2 * i + 1, data.size()); + (container.*fu)(matrix_free, + this->dst, + this->src, + std::make_pair(data[2 * i], data[2 * i + 1])); + } } public: