Boost C++ Libraries: Ticket #11975: Null pointer dereference in boost::filesystem::copy https://svn.boost.org/trac10/ticket/11975 <p> When calling the exception version of <code>boost::filesystem::copy</code> a null pointer is dereferenced. </p> <p> Testcase: </p> <pre class="wiki">#include &lt;boost/filesystem.hpp&gt; int main() { boost::filesystem::copy("/does/not/matter", "/neither/does/this"); } </pre><p> Using the undefined behaviour sanitizer in clang 3.6.2-1 or g++5.2.1 (<code>-fsanitize=undefined</code>) gives the following message: </p> <p> <code>boost_1_60_0/libs/filesystem/src/operations.cpp:879:40: runtime error: reference binding to null pointer of type 'system::error_code'</code> </p> <p> Callstack: </p> <pre class="wiki">#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 </pre><p> It does not appear to have been fixed in the trunk version as far as I can tell. </p> <p> It also seems to be close in kind to <a class="new ticket" href="https://svn.boost.org/trac10/ticket/10450" title="#10450: Bugs: Undefined behavior in ... (new)">#10450</a>, so a review to see if other null pointer dereferences are lurking elsewhere might be in order. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11975 Trac 1.4.3