Boost C++ Libraries: Ticket #10450: Undefined behavior in boost::filesystem::detail::directory_iterator_construct https://svn.boost.org/trac10/ticket/10450 <p> boost/libs/filesystem/src/operations.cpp:2178:28: runtime error: reference binding to null pointer of type 'struct error_code' </p> <p> The problem is this line: it.increment(*ec); </p> <p> ec is 0 when directory_iterator_construct is called from operations.hpp:793 </p> <pre class="wiki">explicit directory_iterator(const path&amp; p) : m_imp(new detail::dir_itr_imp) { detail::directory_iterator_construct(*this, p, 0); } </pre><pre class="wiki">[...undefined behavior sanitiser noise...] #3 0x00005555566e623c in boost::filesystem::detail::directory_iterator_construct (it=..., p=..., ec=ec@entry=0x0) at functional/boost/libs/filesystem/src/operations.cpp:2178 #4 0x00005555566b3cfe in directory_iterator (p=..., this=0x7fffffffd7e0) at functional/boost/boost/filesystem/operations.hpp:793 #5 recursive_directory_iterator (opt=boost::filesystem::none, dir_path=..., this=0x7fffffffd760) at functional/boost/boost/filesystem/operations.hpp:1037 [...my code...] </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10450 Trac 1.4.3 egrindha@… Thu, 25 Sep 2014 07:12:06 GMT attachment set https://svn.boost.org/trac10/ticket/10450 https://svn.boost.org/trac10/ticket/10450 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">0001-Fix-null-pointer-dereference-in-boost.patch</span> </li> </ul> <p> possible fix </p> Ticket luc.hermitte@… Mon, 27 Feb 2017 15:15:41 GMT <link>https://svn.boost.org/trac10/ticket/10450#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10450#comment:1</guid> <description> <p> I see the problem hasn't been fixed in boost 1.63.0 yet. </p> <p> As a null value for <code>ec</code> in <code>directory_iterator_increment()</code> is legit, can't we simply change <code>directory_iterator::increment(system::error_code&amp;)</code> into a function that expects a pointer? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 15 Sep 2017 13:56:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10450#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10450#comment:2</guid> <description> <p> Still not fixed in 1.65. Suggested patch: github.com/yandex/ClickHouse/commit/094c18bb46fc5d8ea7cbff80755187b7f4f7e81a </p> <p> This is real bug (it cause segfault). </p> </description> <category>Ticket</category> </item> <item> <author>benoit.belley@…</author> <pubDate>Thu, 05 Apr 2018 21:10:19 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10450#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10450#comment:3</guid> <description> <p> We are also hitting this issue. A fix would be nice. </p> </description> <category>Ticket</category> </item> </channel> </rss>