Opened 7 years ago
Closed 7 years ago
#11412 closed Bugs (fixed)
reserve() : null pointer passed to memmove
| Reported by: | Owned by: | Ion Gaztañaga | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | container |
| Version: | Boost 1.58.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
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.
Note:
See TracTickets
for help on using tickets.

Thanks for the report fixed in:
[develop a7f60c1] Fix for Trac #11412 ("reserve() : null pointer passed to memmove")
https://github.com/boostorg/container/commit/a7f60c1e8c02d2590d01474cde9be69c9114db28