Subject: [Boost-bugs] [Boost C++ Libraries] #2752: Wrong size check in bounded_array::resize
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-02-12 16:52:54
#2752: Wrong size check in bounded_array::resize
-------------------------------------------+--------------------------------
Reporter: Ulf Olin <ulf.olin_at_[hidden]> | Owner: guwi17
Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: uBLAS
Version: Boost 1.38.0 | Severity: Problem
Keywords: |
-------------------------------------------+--------------------------------
The resize methods in the bounded_array class, in the file
boost/numeric/ublas/storage.hpp, are defined as
{{{
// Resizing
BOOST_UBLAS_INLINE
void resize (size_type size) {
BOOST_UBLAS_CHECK (size_ <= N, bad_size ());
size_ = size;
}
BOOST_UBLAS_INLINE
void resize (size_type size, value_type init) {
BOOST_UBLAS_CHECK (size_ <= N, bad_size ());
if (size > size_)
std::fill (data_ + size_, data_ + size, init);
size_ = size;
}
}}}
Shouldn't the BOOST_UBLAS_CHECKs test for size < N? As the checks are
written now, it is possible to assign a new size that is larger than N.
Ulf
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2752> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC