Opened 8 years ago
Last modified 5 years ago
#10450 new Bugs
Undefined behavior in boost::filesystem::detail::directory_iterator_construct
Reported by: | Owned by: | Beman Dawes | |
---|---|---|---|
Milestone: | To Be Determined | Component: | filesystem |
Version: | Boost 1.56.0 | Severity: | Problem |
Keywords: | Cc: |
Description
boost/libs/filesystem/src/operations.cpp:2178:28: runtime error: reference binding to null pointer of type 'struct error_code'
The problem is this line: it.increment(*ec);
ec is 0 when directory_iterator_construct is called from operations.hpp:793
explicit directory_iterator(const path& p) : m_imp(new detail::dir_itr_imp) { detail::directory_iterator_construct(*this, p, 0); }
[...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...]
Attachments (1)
Change History (4)
by , 8 years ago
Attachment: | 0001-Fix-null-pointer-dereference-in-boost.patch added |
---|
comment:1 by , 6 years ago
I see the problem hasn't been fixed in boost 1.63.0 yet.
As a null value for ec
in directory_iterator_increment()
is legit, can't we simply change directory_iterator::increment(system::error_code&)
into a function that expects a pointer?
comment:2 by , 5 years ago
Still not fixed in 1.65. Suggested patch: github.com/yandex/ClickHouse/commit/094c18bb46fc5d8ea7cbff80755187b7f4f7e81a
This is real bug (it cause segfault).
possible fix