Re: [Boost-bugs] [Boost C++ Libraries] #2752: Wrong size check in bounded_array::resize

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2752: Wrong size check in bounded_array::resize
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-02-12 18:43:35


#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
Resolution: | Keywords:
--------------------------------------------+-------------------------------

Comment(by Ulf Olin <ulf.olin_at_[hidden]>):

 Say that you have have created a bounded_array with three elements (N=3
 and size_=3). Then you, by mistake, try to resize that bounded_array to
 hold four elements. That is, your code is

 {{{
 #include <boost/numeric/ublas/storage.hpp>

 int main () {
     using namespace boost::numeric::ublas;
     bounded_array<double, 3> a (3);
     a.resize(4); // Should result in an exception, but it doesn't!
 }
 }}}

 The solution for the definition of the resize function is either to check
 the function argument, size, instead of the member size_, or to first do
 the assignment statement and then the check.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2752#comment:2>
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