From e977bb77b59aa60e17023c727d2b3ed6f2e95e8c Mon Sep 17 00:00:00 2001 From: Ronald Garcia Date: Tue, 14 Feb 2006 19:26:11 +0000 Subject: [PATCH] Added range checking to the view creation code. [SVN r32928] --- include/boost/multi_array/base.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/boost/multi_array/base.hpp b/include/boost/multi_array/base.hpp index 6cd5291..9206701 100644 --- a/include/boost/multi_array/base.hpp +++ b/include/boost/multi_array/base.hpp @@ -439,6 +439,12 @@ protected: index index_factor = current_range.stride(); index len = (finish - start + (index_factor - 1)) / index_factor; + BOOST_ASSERT(index_bases[n] <= start && + start < index_bases[n]+index(extents[n])); + BOOST_ASSERT(index_bases[n] <= finish && + finish <= index_bases[n]+index(extents[n])); + BOOST_ASSERT(index_factor > 0); + // the array data pointer is modified to account for non-zero // bases during slicing (see [Garcia] for the math involved) offset += start * strides[n];