[Boost-bugs] [Boost C++ Libraries] #11412: reserve() : null pointer passed to memmove

Subject: [Boost-bugs] [Boost C++ Libraries] #11412: reserve() : null pointer passed to memmove
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-06-22 06:37:41


#11412: reserve() : null pointer passed to memmove
-------------------------------------------------+------------------------
 Reporter: Alexandre Hamez <alexandre.hamez@…> | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: container
  Version: Boost 1.58.0 | Severity: Problem
 Keywords: |
-------------------------------------------------+------------------------
 The following error is reported
 {{{
 boost/container/detail/copy_move_algo.hpp:199:4: runtime error: null
 pointer passed as argument 2, which is declared to never be null
 }}}

 when compiling the following example with GCC 5 with the
 {{{-fsanitize=undefined}}} option

 {{{
 #include <boost/container/flat_set.hpp>

 int main ()
 {
   boost::container::flat_set<unsigned int> fs;
   fs.reserve(10);
   return 0;
 }
 }}}

 Indeed, when putting a breakpoint at the reported line, the {{{f}}}
 argument is null.

 {{{
 std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f),
 sizeof(value_type)*n);
 }}}

 However, valgrind does not report anything and calling {{{capacity()}}}
 reports the correct size.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11412>
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:50:18 UTC