aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Wrzalik <kwrzalik@gmail.com>2016-09-18 17:56:18 +0200
committerKrzysztof Wrzalik <kwrzalik@gmail.com>2016-09-18 17:56:18 +0200
commit6cb0e3082a2b475d2ef5e9b591c60ae98bb3c483 (patch)
treeecbb70b39e0d03e325100c6cb2f87c6eba58af8d
parent22c27854529b1e5c5da2b4845ffac764f208326d (diff)
downloadplatform_external_Microsoft-GSL-6cb0e3082a2b475d2ef5e9b591c60ae98bb3c483.tar.gz
platform_external_Microsoft-GSL-6cb0e3082a2b475d2ef5e9b591c60ae98bb3c483.tar.bz2
platform_external_Microsoft-GSL-6cb0e3082a2b475d2ef5e9b591c60ae98bb3c483.zip
Added a fix for not flagging negative indices to multi_span.
-rw-r--r--gsl/multi_span4
1 files changed, 2 insertions, 2 deletions
diff --git a/gsl/multi_span b/gsl/multi_span
index 0abc7c1..40752aa 100644
--- a/gsl/multi_span
+++ b/gsl/multi_span
@@ -443,7 +443,7 @@ namespace details
template <typename T, size_t Dim = 0>
size_type linearize(const T& arr) const
{
- Expects(arr[Dim] < CurrentRange); // Index is out of range
+ Expects(arr[Dim] >= 0 && arr[Dim] < CurrentRange); // Index is out of range
return this->Base::totalSize() * arr[Dim] +
this->Base::template linearize<T, Dim + 1>(arr);
}
@@ -1510,7 +1510,7 @@ public:
template <bool Enabled = (Rank > 1), typename Ret = std::enable_if_t<Enabled, sliced_type>>
constexpr Ret operator[](size_type idx) const noexcept
{
- Expects(idx < bounds_.size()); // index is out of bounds of the array
+ Expects(idx >= 0 && idx < bounds_.size()); // index is out of bounds of the array
const size_type ridx = idx * bounds_.stride();
// index is out of bounds of the underlying data