[Boost-bugs] [Boost C++ Libraries] #11975: Null pointer dereference in boost::filesystem::copy

Subject: [Boost-bugs] [Boost C++ Libraries] #11975: Null pointer dereference in boost::filesystem::copy
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-02-10 15:58:41


#11975: Null pointer dereference in boost::filesystem::copy
-------------------------------------------------+-------------------------
 Reporter: Michael Rasmussen | Owner: bemandawes
  <Michael.Rasmussen@…> | Status: new
     Type: Bugs | Component: filesystem
Milestone: To Be Determined | Severity: Problem
  Version: Boost 1.60.0 |
 Keywords: |
-------------------------------------------------+-------------------------
 When calling the exception version of {{{boost::filesystem::copy}}} a null
 pointer is dereferenced.

 Testcase:
 {{{
 #include <boost/filesystem.hpp>
 int main()
 {
     boost::filesystem::copy("/does/not/matter", "/neither/does/this");
 }
 }}}

 Using the undefined behaviour sanitizer in clang 3.6.2-1 or g++5.2.1
 ({{{-fsanitize=undefined}}}) gives the following message:

 {{{boost_1_60_0/libs/filesystem/src/operations.cpp:879:40: runtime error:
 reference binding to null pointer of type 'system::error_code'}}}

 Callstack:
 {{{
 #0 boost::filesystem::detail::copy (from=..., to=..., ec=0x0) at
 boost_1_60_0/libs/filesystem/src/operations.cpp:879
 #1 0x0000000000441421 in boost::filesystem::copy (from=..., to=...) at
 boost_1_60_0/boost/filesystem/operations.hpp:524
 #2 0x000000000044013e in main () at boost_filesystem_copy_bug.cpp:5
 }}}

 It does not appear to have been fixed in the trunk version as far as I can
 tell.

 It also seems to be close in kind to #10450, so a review to see if other
 null pointer dereferences are lurking elsewhere might be in order.

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