|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83797 - trunk/boost/container
From: igaztanaga_at_[hidden]
Date: 2013-04-07 15:11:23
Author: igaztanaga
Date: 2013-04-07 15:11:22 EDT (Sun, 07 Apr 2013)
New Revision: 83797
URL: http://svn.boost.org/trac/boost/changeset/83797
Log:
Added bounds checking via BOOST_ASSERT to operator[]
Text files modified:
trunk/boost/container/stable_vector.hpp | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
Modified: trunk/boost/container/stable_vector.hpp
==============================================================================
--- trunk/boost/container/stable_vector.hpp (original)
+++ trunk/boost/container/stable_vector.hpp 2013-04-07 15:11:22 EDT (Sun, 07 Apr 2013)
@@ -1127,7 +1127,10 @@
//!
//! <b>Complexity</b>: Constant.
reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
- { return static_cast<node_reference>(*this->index[n]).value; }
+ {
+ BOOST_ASSERT(n < this->size());
+ return static_cast<node_reference>(*this->index[n]).value;
+ }
//! <b>Requires</b>: size() > n.
//!
@@ -1138,7 +1141,10 @@
//!
//! <b>Complexity</b>: Constant.
const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
- { return static_cast<const_node_reference>(*this->index[n]).value; }
+ {
+ BOOST_ASSERT(n < this->size());
+ return static_cast<const_node_reference>(*this->index[n]).value;
+ }
//! <b>Requires</b>: size() > n.
//!
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk